{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "0de436ce",
   "metadata": {},
   "source": [
    "这个是测试自己编写的库文件是否起作用的最简代码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "24e07c46",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'example_package'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[1], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexample_package\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mexample\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m      2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mmath\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m sqrt\n\u001b[1;32m      3\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m单位正三角形面积为：\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m{:0.4f}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(triangle_area([\u001b[38;5;241m1\u001b[39m,sqrt(\u001b[38;5;241m2\u001b[39m),\u001b[38;5;241m1\u001b[39m])))\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'example_package'"
     ]
    }
   ],
   "source": [
    "from example_package.example import *\n",
    "from math import sqrt\n",
    "print(\"单位正三角形面积为：%s\" % \"{:0.4f}\".format(triangle_area([1,sqrt(2),1])))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "86702414",
   "metadata": {},
   "outputs": [],
   "source": [
    " import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "28390787",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(np.rad2deg)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "df1b4e88",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(SOPform)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "feac48c8",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "72d6a1df",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(symbols)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "311e45f0",
   "metadata": {},
   "outputs": [],
   "source": [
    "a={\"x\":1,\"y\":2}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e60805ea",
   "metadata": {},
   "outputs": [],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "baad6d87",
   "metadata": {},
   "outputs": [],
   "source": [
    "len(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "548ffa8d",
   "metadata": {},
   "outputs": [],
   "source": [
    "Mod(3.45,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "51f80ef4",
   "metadata": {},
   "outputs": [],
   "source": [
    "round(3.4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "feed4182",
   "metadata": {},
   "outputs": [],
   "source": [
    "def rad2deg(rad,**kw):\n",
    "    if len(kw)==0:\n",
    "        return rad/pi*180\n",
    "    elif kw[\"format\"]==\"second\":\n",
    "        temp=rad/pi*180\n",
    "        remainder=Mod(temp,1)\n",
    "        total_seconds=round(remainder*3600)\n",
    "        return [floor(temp),floor(total_seconds/60),Mod(total_seconds,60)]\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c1da92d8",
   "metadata": {},
   "outputs": [],
   "source": [
    "rad2deg((pi-acos(Rational(1,3)))/2,format=\"second\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "236c0b5b",
   "metadata": {},
   "outputs": [],
   "source": [
    "Mod(45,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3387e0af",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pytest"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "10a445c7",
   "metadata": {},
   "outputs": [],
   "source": [
    "assert rad2deg(pi/3)==60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "20c870f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "423b8e2d",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(imageset)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e95bc7a7",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import n,m"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a693e7eb",
   "metadata": {},
   "outputs": [],
   "source": [
    "refine(abs(n-1),Q.positive(n-1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71c33192",
   "metadata": {},
   "outputs": [],
   "source": [
    "abs(n-1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2001052e",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Q)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5828c161",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(refine)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4a65a0ca",
   "metadata": {},
   "outputs": [],
   "source": [
    "imageset()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "529e4aab",
   "metadata": {},
   "outputs": [],
   "source": [
    "3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f11a2a1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c=symbols(\"a,b,c\",positive=True)\n",
    "A,B,C=symbols(\"A,B,C\",positive=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e986b0e4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import x,y,z,t"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e95aa222",
   "metadata": {},
   "outputs": [],
   "source": [
    "eqt=simplify(Eq((2*a-b)/2,cos(B)/cos(C)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d55b881f",
   "metadata": {},
   "outputs": [],
   "source": [
    "(cancel(eqt.lhs-eqt.rhs))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c5bdf3da",
   "metadata": {},
   "outputs": [],
   "source": [
    "type(together(eqt.lhs-eqt.rhs))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1fc575d9",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Mul)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9d58e3eb",
   "metadata": {},
   "outputs": [],
   "source": [
    "fraction(together(eqt.lhs-eqt.rhs))[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "62212c4a",
   "metadata": {},
   "outputs": [],
   "source": [
    "trigsimp(sin(A)*cos(B)+cos(A)*sin(B))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "698b498c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6c6cdd4a",
   "metadata": {},
   "outputs": [],
   "source": [
    "for item in sin(x+y-45).atoms(Function):\n",
    "    print(type(item))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ecac3a6f",
   "metadata": {},
   "outputs": [],
   "source": [
    "type(sin(x*pi/2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "08b4132e",
   "metadata": {},
   "outputs": [],
   "source": [
    "(1/sqrt(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "384754c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "powsimp(solve(x**2-(4+2*sqrt(3)))[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b060a0fb",
   "metadata": {},
   "outputs": [],
   "source": [
    "from abc import abstractmethod"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "417751b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(abstractmethod)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1827b9b7",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sympy.this\n",
    "\n",
    "print(s)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e255b5d9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.matrices import *\n",
    "class Geo(Matrix):\n",
    "\n",
    "\n",
    "    pass\n",
    "\n",
    "class Point(Geo):\n",
    "\n",
    "    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bfeb9900",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Point([1,2,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "192cfd7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Point([2,3,4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "60bfa90c",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=[A,B]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a5fbc1fc",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "type(A+B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7201b246",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "58dbcc2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "Point.zeros(3,1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "013627ab",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "q=Matrix(2,2,(1,2,3,4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ead5ee7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "q[3]=1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "910d8a78",
   "metadata": {},
   "outputs": [],
   "source": [
    "q**1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1a4eb4da",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Matrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ceb04e84",
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import List"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aee2b728",
   "metadata": {},
   "outputs": [],
   "source": [
    "def norm(A: List[Geo],norm_pow=Rational(2),**kws) -> Geo:\n",
    "    norm_answer=A[0]**norm_pow\n",
    "    if(len(kws))==0:\n",
    "        for i in range(1,len(A)):\n",
    "            norm_answer+=A[i]**norm_pow\n",
    "    else:\n",
    "        pass\n",
    "\n",
    "    return norm_answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "63aaca35",
   "metadata": {},
   "outputs": [],
   "source": [
    "norm([A,B],1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d2b2b775",
   "metadata": {},
   "outputs": [],
   "source": [
    "Matrix.zeros(1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b456de1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(ZeroMatrix)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c6f03129",
   "metadata": {},
   "outputs": [],
   "source": [
    "shape(A)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "df4f8695",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "def midpoint(A: int,B: int) -> int:\n",
    "    print(type(A))\n",
    "    return (A+B)/2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6316cbea",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "midpoint(1.2,3.4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c77ada08",
   "metadata": {},
   "outputs": [],
   "source": [
    "import sys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "14a56c9b",
   "metadata": {},
   "outputs": [],
   "source": [
    "sys.path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "66d8e099",
   "metadata": {},
   "outputs": [],
   "source": [
    "sys.path.append(\"/home/huang/Documents/packaging_tutorial/src\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dd950081",
   "metadata": {},
   "outputs": [],
   "source": [
    "sys.path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "58877e7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from function_calculator_package.extreme_points import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "23326161",
   "metadata": {},
   "outputs": [],
   "source": [
    "function_max(ln(x)/x,x,Interval.open(0,oo),True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9132b4a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from quadratic_function.parabola import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d8f31193",
   "metadata": {},
   "outputs": [],
   "source": [
    "p>0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ba55c1b6",
   "metadata": {},
   "outputs": [],
   "source": [
    "parabola_x_function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "95544bb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "G=Point([1,-2,3])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "559bda88",
   "metadata": {},
   "outputs": [],
   "source": [
    "G.norm()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "12e0bee2",
   "metadata": {},
   "outputs": [],
   "source": [
    "solveset(x**2-x>=0,x,Interval.open(0,1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "78a3d5bb",
   "metadata": {},
   "outputs": [],
   "source": [
    "solveset(sin(x)-x,x,Reals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ec0c96c0",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Set)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "22a143b4",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(norm)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "804f64a0",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check=Interval.Ropen(1,2)\n",
    "interval_check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f97cc74",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.is_closed"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dd6a5f25",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.left_open"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2c5ba554",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.right_open"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "889918da",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(limit)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a5fd108c",
   "metadata": {},
   "outputs": [],
   "source": [
    "solve(sin(x)-x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dfb15432",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(NotImplementedError)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e3f86d4a",
   "metadata": {},
   "outputs": [],
   "source": [
    "help([])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ce1e6d09",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a=[1,2,3]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ccd05d1d",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a[-1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "dd929f60",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a.insert(2,pi)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aea11db2",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a.sort()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "20a56b47",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "42d7431d",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f78fcebb",
   "metadata": {},
   "outputs": [],
   "source": [
    "list_a.insert(0,0)\n",
    "list_a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "14fe4333",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.inf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6d374e10",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.inf in interval_check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "64cb9315",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.sup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "db7e7494",
   "metadata": {},
   "outputs": [],
   "source": [
    "interval_check.sup in interval_check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ec7404e9",
   "metadata": {},
   "outputs": [],
   "source": [
    "Reals.sup in Reals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76b3b592",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "Reals.right_open"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9673dd1a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.geometry import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6541e941",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(Point)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bb2ae796",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Point(1,2,3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "33355edb",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Point(2,7,4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8c526c90",
   "metadata": {},
   "outputs": [],
   "source": [
    "Line(A,B).coefficients"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "78ec7b77",
   "metadata": {},
   "outputs": [],
   "source": [
    "import warnings\n",
    "help(warnings)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "04728145",
   "metadata": {},
   "source": [
    "### 关于递推数列的一般性思考"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9ff8b58c",
   "metadata": {},
   "source": [
    "我突然在想，如果数列的递推关系式是可以递推的，那么接下来，很多时候我们想的（或者说做的就）是同构。通过同构，把一个复杂的递推关系化简成最简单的等差或者说相等数列。这样问题就解决了。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c019e575",
   "metadata": {},
   "source": [
    "那么，接下来的问题是，哪些递推数列是可以同构的呢？"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f09c76a5",
   "metadata": {},
   "source": [
    "#### 关于什么数列是具有周期性的问题 "
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ba3f3c9f",
   "metadata": {},
   "source": [
    "不得不提一个特别的问题，**什么样的数列是不具有周期性的？**"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5cb947ec",
   "metadata": {},
   "source": [
    "很明显，一个数列可以看成是函数的子集，而对于函数，一个函数在自变量向一个方向跑远时，要么发散，要么收敛，要么就是是摆动。\n",
    "\n",
    "所以，一个不具有周期性（不一定要是周期函数，具有周期性【在这里是摆动的另一种说法】）的数列，要么收敛，要么发散。\n",
    "\n",
    "而数列不会超出这个范围。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0220d068",
   "metadata": {},
   "outputs": [],
   "source": [
    "abs(1+I)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4198e561",
   "metadata": {},
   "outputs": [],
   "source": [
    "from numpy import linspace\n",
    "n=50\n",
    "answer_x=linspace(0,n,n+1)\n",
    "# a=(Rational(101,100)+sqrt(7)*I)/2\n",
    "a=2\n",
    "answer=[a]\n",
    "for i in range(n):\n",
    "    answer.append(simplify(Rational(2,(1-answer[i]))))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eac47832",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f1aba0f0",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "88a6aa48",
   "metadata": {},
   "outputs": [],
   "source": [
    "fraction(1,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7b379682",
   "metadata": {},
   "outputs": [],
   "source": [
    "(1-2/(3+I))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f336652",
   "metadata": {},
   "outputs": [],
   "source": [
    "# import the required libraries  \n",
    "import random  \n",
    "import matplotlib.pyplot as plt  \n",
    "    \n",
    "# store the random numbers in a list  \n",
    "nums = []  \n",
    "mu = 100\n",
    "sigma = 25\n",
    "    \n",
    "for i in range(10000):  \n",
    "    temp = random.gauss(mu, sigma)  \n",
    "    nums.append(temp)  \n",
    "        \n",
    "# plotting a graph  \n",
    "plt.hist(nums, bins = 200)  \n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6f1bcff3",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.solvers.inequalities import reduce_rational_inequalities"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "291af0e0",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(reduce_rational_inequalities)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d559f847",
   "metadata": {},
   "outputs": [],
   "source": [
    "x,y=symbols(\"x,y\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f9680cfa",
   "metadata": {},
   "outputs": [],
   "source": [
    "reduce_rational_inequalities([[x+3>2]],x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "f472fa8f",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(plot_implicit)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "718dab2f",
   "metadata": {},
   "outputs": [],
   "source": [
    "plot_implicit((x**2 + y**2<3), (x, -3, 3), (y, -3, 3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ddd43afc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">Manim Community <span style=\"color: #008000; text-decoration-color: #008000\">v0.17.2</span>\n",
       "\n",
       "</pre>\n"
      ],
      "text/plain": [
       "Manim Community \u001b[32mv0.\u001b[0m\u001b[32m17.2\u001b[0m\n",
       "\n"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "from manim import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "46a85aed",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "                                                                                \r"
     ]
    },
    {
     "data": {
      "text/html": [
       "<video src=\"media/jupyter/CircleToSquare@2024-01-12@10-00-09.mp4\" controls autoplay loop style=\"max-width: 60%;\"  >\n",
       "      Your browser does not support the <code>video</code> element.\n",
       "    </video>"
      ],
      "text/plain": [
       "<IPython.core.display.Video object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%%manim -qm -v WARNING CircleToSquare\n",
    "\n",
    "class CircleToSquare(Scene):\n",
    "    def construct(self):\n",
    "        blue_circle = Circle(color=BLUE, fill_opacity=0.5)\n",
    "        green_square = Square(color=GREEN, fill_opacity=0.8)\n",
    "        self.play(Create(blue_circle))\n",
    "        self.wait()\n",
    "        \n",
    "        self.play(Transform(blue_circle, green_square))\n",
    "        self.wait()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "10b63b32",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import Symbol, And, Or, Not,GT, GE, LT, Plus, Equals, Int, get_model\n",
    "from pysmt.typing import INT\n",
    "\n",
    "hello = [Symbol(s, INT) for s in \"hello\"]\n",
    "world = [Symbol(s, INT) for s in \"world\"]\n",
    "letters = set(hello+world)\n",
    "domains = And([And(GE(l, Int(1)),\n",
    "                   LT(l, Int(10))) for l in letters])\n",
    "letters_list=list(letters)\n",
    "difference = []\n",
    "\n",
    "for i in range(len(letters_list)-1):\n",
    "    difference.append(Or(GT(letters_list[i], letters_list[i+1]),\n",
    "                         LT(letters_list[i], letters_list[i+1])))\n",
    "restrains = And(difference)\n",
    "\n",
    "sum_hello = Plus(hello) # n-ary operators can take lists\n",
    "sum_world = Plus(world) # as arguments\n",
    "problem = And(Equals(sum_hello, sum_world),\n",
    "              Equals(sum_hello, Int(25)))\n",
    "formula = And(domains, restrains, problem)\n",
    "\n",
    "print(\"Serialization of the formula:\")\n",
    "print(formula)\n",
    "\n",
    "model = get_model(formula)\n",
    "if model:\n",
    "  print(model)\n",
    "else:\n",
    "  print(\"No solution found\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "798d74f9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import Symbol, And, Or, Not, get_model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8281bd30",
   "metadata": {},
   "outputs": [],
   "source": [
    "A=Symbol(\"A\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9312cf13",
   "metadata": {},
   "outputs": [],
   "source": [
    "B=Symbol(\"B\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ed51d323",
   "metadata": {},
   "outputs": [],
   "source": [
    "f=Or(A,B)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8274c18f",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7174ab53",
   "metadata": {},
   "outputs": [],
   "source": [
    "print(get_model(f))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52465e3e",
   "metadata": {},
   "outputs": [],
   "source": [
    "from z3 import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "258d5178",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(z3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d12abdeb",
   "metadata": {},
   "outputs": [],
   "source": [
    "Tie, Shirt = Bools('Tie Shirt')\n",
    "s = Solver()\n",
    "s.add(Or(Tie, Shirt),\n",
    "    Or(Not(Tie), Shirt),\n",
    "    Or(Not(Tie), Not(Shirt)))\n",
    "print(s.check())\n",
    "print(s.model())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "56765083",
   "metadata": {},
   "outputs": [],
   "source": [
    "del a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "7831a439",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c,d,e,f,g,h=Ints(\"a b c d e f g h\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "id": "cbb07ce8",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=Solver()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "0c827d9c",
   "metadata": {},
   "outputs": [],
   "source": [
    "domain=And(a>=0,a<3,b>=0,b<3,c>=0,c<3,d>=0,d<3,e>=0,e<3,f>=0,f<3,g>=0,g<3,h>=0,h<3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "cef8b91d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "a &ge; 0 &and;\n",
       "a &lt; 3 &and;\n",
       "b &ge; 0 &and;\n",
       "b &lt; 3 &and;\n",
       "c &ge; 0 &and;\n",
       "c &lt; 3 &and;\n",
       "d &ge; 0 &and;\n",
       "d &lt; 3 &and;\n",
       "e &ge; 0 &and;\n",
       "e &lt; 3 &and;\n",
       "f &ge; 0 &and;\n",
       "f &lt; 3 &and;\n",
       "g &ge; 0 &and;\n",
       "g &lt; 3 &and;\n",
       "h &ge; 0 &and;\n",
       "h &lt; 3"
      ],
      "text/plain": [
       "And(a >= 0,\n",
       "    a < 3,\n",
       "    b >= 0,\n",
       "    b < 3,\n",
       "    c >= 0,\n",
       "    c < 3,\n",
       "    d >= 0,\n",
       "    d < 3,\n",
       "    e >= 0,\n",
       "    e < 3,\n",
       "    f >= 0,\n",
       "    f < 3,\n",
       "    g >= 0,\n",
       "    g < 3,\n",
       "    h >= 0,\n",
       "    h < 3)"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "domain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "c38d939c",
   "metadata": {},
   "outputs": [],
   "source": [
    "problem=And(a!=b,a!=d,a!=e,b!=c,b!=f,c!=d,c!=g,f!=g,e!=f,d!=h,h!=e,h!=g)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "71d4f81e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "a &ne; b &and;\n",
       "a &ne; d &and;\n",
       "a &ne; e &and;\n",
       "b &ne; c &and;\n",
       "b &ne; f &and;\n",
       "c &ne; d &and;\n",
       "c &ne; g &and;\n",
       "f &ne; g &and;\n",
       "e &ne; f &and;\n",
       "d &ne; h &and;\n",
       "h &ne; e &and;\n",
       "h &ne; g"
      ],
      "text/plain": [
       "And(a != b,\n",
       "    a != d,\n",
       "    a != e,\n",
       "    b != c,\n",
       "    b != f,\n",
       "    c != d,\n",
       "    c != g,\n",
       "    f != g,\n",
       "    e != f,\n",
       "    d != h,\n",
       "    h != e,\n",
       "    h != g)"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "problem"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "f397d054",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(domain,problem)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "id": "bdaa64b4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.check()==sat"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "86a029b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "[f = 2, b = 1, a = 0, d = 2, g = 1, h = 0, c = 0, e = 1]"
      ],
      "text/plain": [
       "[f = 2, b = 1, a = 0, d = 2, g = 1, h = 0, c = 0, e = 1]"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.model()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "0e9d5e7c",
   "metadata": {},
   "outputs": [],
   "source": [
    "variate=[f,b,a,d,g,h,c,e]\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "c35e0b6b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[f = 2, b = 1, a = 0, d = 1, g = 1, h = 0, c = 2, e = 1]\n",
      "1\n",
      "[f = 1, b = 0, a = 1, d = 2, g = 2, h = 1, c = 1, e = 2]\n",
      "2\n",
      "[f = 2, b = 0, a = 1, d = 0, g = 0, h = 1, c = 1, e = 0]\n",
      "3\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 1, c = 1, e = 0]\n",
      "4\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 2, c = 1, e = 0]\n",
      "5\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 2, c = 1, e = 1]\n",
      "6\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 2, c = 1, e = 0]\n",
      "7\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 2, c = 2, e = 0]\n",
      "8\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 2, c = 2, e = 1]\n",
      "9\n",
      "[f = 0, b = 1, a = 2, d = 1, g = 1, h = 2, c = 2, e = 1]\n",
      "10\n",
      "[f = 0, b = 2, a = 0, d = 1, g = 1, h = 2, c = 0, e = 1]\n",
      "11\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 2, c = 0, e = 1]\n",
      "12\n",
      "[f = 2, b = 1, a = 0, d = 1, g = 1, h = 2, c = 0, e = 1]\n",
      "13\n",
      "[f = 0, b = 1, a = 2, d = 1, g = 1, h = 2, c = 0, e = 1]\n",
      "14\n",
      "[f = 0, b = 1, a = 2, d = 0, g = 1, h = 2, c = 2, e = 1]\n",
      "15\n",
      "[f = 2, b = 1, a = 2, d = 0, g = 1, h = 2, c = 2, e = 1]\n",
      "16\n",
      "[f = 2, b = 1, a = 2, d = 0, g = 0, h = 2, c = 2, e = 1]\n",
      "17\n",
      "[f = 2, b = 1, a = 0, d = 1, g = 0, h = 2, c = 2, e = 1]\n",
      "18\n",
      "[f = 2, b = 1, a = 0, d = 1, g = 1, h = 2, c = 2, e = 1]\n",
      "19\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 2, c = 2, e = 1]\n",
      "20\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 0, h = 2, c = 2, e = 1]\n",
      "21\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 2, c = 0, e = 1]\n",
      "22\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 1, h = 2, c = 2, e = 1]\n",
      "23\n",
      "[f = 2, b = 0, a = 2, d = 1, g = 1, h = 2, c = 2, e = 1]\n",
      "24\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 2, c = 2, e = 1]\n",
      "25\n",
      "[f = 2, b = 0, a = 2, d = 1, g = 0, h = 2, c = 2, e = 1]\n",
      "26\n",
      "[f = 1, b = 0, a = 2, d = 0, g = 0, h = 2, c = 1, e = 0]\n",
      "27\n",
      "[f = 2, b = 0, a = 1, d = 0, g = 0, h = 2, c = 1, e = 0]\n",
      "28\n",
      "[f = 2, b = 0, a = 1, d = 0, g = 0, h = 2, c = 2, e = 0]\n",
      "29\n",
      "[f = 1, b = 2, a = 1, d = 0, g = 0, h = 2, c = 1, e = 0]\n",
      "30\n",
      "[f = 1, b = 0, a = 2, d = 1, g = 0, h = 2, c = 2, e = 0]\n",
      "31\n",
      "[f = 1, b = 0, a = 2, d = 0, g = 0, h = 2, c = 2, e = 0]\n",
      "32\n",
      "[f = 2, b = 0, a = 2, d = 1, g = 1, h = 2, c = 2, e = 0]\n",
      "33\n",
      "[f = 2, b = 0, a = 2, d = 1, g = 0, h = 2, c = 2, e = 0]\n",
      "34\n",
      "[f = 2, b = 0, a = 1, d = 0, g = 1, h = 2, c = 2, e = 0]\n",
      "35\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 1, h = 2, c = 2, e = 0]\n",
      "36\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 2, c = 2, e = 0]\n",
      "37\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 0, h = 2, c = 2, e = 0]\n",
      "38\n",
      "[f = 2, b = 1, a = 2, d = 0, g = 1, h = 2, c = 2, e = 0]\n",
      "39\n",
      "[f = 2, b = 1, a = 2, d = 0, g = 0, h = 2, c = 2, e = 0]\n",
      "40\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 2, c = 2, e = 0]\n",
      "41\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 2, c = 0, e = 0]\n",
      "42\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 0, c = 0, e = 2]\n",
      "43\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 1, c = 0, e = 2]\n",
      "44\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 0, c = 0, e = 1]\n",
      "45\n",
      "[f = 0, b = 2, a = 1, d = 2, g = 2, h = 1, c = 0, e = 2]\n",
      "46\n",
      "[f = 0, b = 2, a = 1, d = 2, g = 2, h = 0, c = 0, e = 2]\n",
      "47\n",
      "[f = 1, b = 2, a = 0, d = 2, g = 2, h = 1, c = 0, e = 2]\n",
      "48\n",
      "[f = 1, b = 2, a = 0, d = 2, g = 2, h = 0, c = 0, e = 2]\n",
      "49\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 1, c = 0, e = 2]\n",
      "50\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 0, c = 0, e = 2]\n",
      "51\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 1, c = 1, e = 2]\n",
      "52\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 0, c = 1, e = 2]\n",
      "53\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 1, c = 1, e = 0]\n",
      "54\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 2, h = 1, c = 0, e = 0]\n",
      "55\n",
      "[f = 1, b = 2, a = 1, d = 0, g = 2, h = 1, c = 1, e = 0]\n",
      "56\n",
      "[f = 1, b = 2, a = 1, d = 0, g = 0, h = 1, c = 1, e = 0]\n",
      "57\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 0, h = 1, c = 1, e = 0]\n",
      "58\n",
      "[f = 1, b = 2, a = 1, d = 0, g = 0, h = 1, c = 1, e = 2]\n",
      "59\n",
      "[f = 1, b = 2, a = 1, d = 0, g = 2, h = 1, c = 1, e = 2]\n",
      "60\n",
      "[f = 1, b = 2, a = 1, d = 2, g = 0, h = 1, c = 1, e = 2]\n",
      "61\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 1, c = 2, e = 2]\n",
      "62\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 1, c = 2, e = 0]\n",
      "63\n",
      "[f = 1, b = 0, a = 1, d = 2, g = 0, h = 1, c = 1, e = 2]\n",
      "64\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 1, c = 1, e = 2]\n",
      "65\n",
      "[f = 1, b = 0, a = 1, d = 2, g = 0, h = 1, c = 1, e = 0]\n",
      "66\n",
      "[f = 1, b = 0, a = 1, d = 2, g = 2, h = 1, c = 1, e = 0]\n",
      "67\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 2, h = 1, c = 1, e = 0]\n",
      "68\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 2, h = 1, c = 1, e = 2]\n",
      "69\n",
      "[f = 1, b = 0, a = 1, d = 0, g = 0, h = 1, c = 1, e = 0]\n",
      "70\n",
      "[f = 1, b = 0, a = 1, d = 2, g = 2, h = 0, c = 1, e = 2]\n",
      "71\n",
      "[f = 1, b = 2, a = 0, d = 1, g = 2, h = 0, c = 0, e = 2]\n",
      "72\n",
      "[f = 1, b = 2, a = 0, d = 2, g = 2, h = 0, c = 1, e = 2]\n",
      "73\n",
      "[f = 1, b = 2, a = 0, d = 2, g = 0, h = 1, c = 1, e = 2]\n",
      "74\n",
      "[f = 1, b = 2, a = 0, d = 2, g = 2, h = 1, c = 1, e = 2]\n",
      "75\n",
      "[f = 1, b = 0, a = 2, d = 0, g = 0, h = 1, c = 2, e = 0]\n",
      "76\n",
      "[f = 1, b = 0, a = 2, d = 0, g = 0, h = 1, c = 1, e = 0]\n",
      "77\n",
      "[f = 1, b = 0, a = 2, d = 0, g = 2, h = 1, c = 1, e = 0]\n",
      "78\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 0, c = 0, e = 1]\n",
      "79\n",
      "[f = 2, b = 1, a = 0, d = 1, g = 1, h = 0, c = 0, e = 1]\n",
      "80\n",
      "[f = 0, b = 1, a = 2, d = 1, g = 1, h = 0, c = 0, e = 1]\n",
      "81\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 0, c = 0, e = 1]\n",
      "82\n",
      "[f = 0, b = 2, a = 0, d = 1, g = 1, h = 0, c = 0, e = 1]\n",
      "83\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 0, c = 2, e = 1]\n",
      "84\n",
      "[f = 0, b = 1, a = 2, d = 1, g = 1, h = 0, c = 2, e = 1]\n",
      "85\n",
      "[f = 0, b = 2, a = 0, d = 1, g = 2, h = 0, c = 0, e = 1]\n",
      "86\n",
      "[f = 0, b = 2, a = 0, d = 1, g = 2, h = 0, c = 0, e = 2]\n",
      "87\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 2, h = 0, c = 0, e = 1]\n",
      "88\n",
      "[f = 0, b = 1, a = 2, d = 1, g = 2, h = 0, c = 0, e = 1]\n",
      "89\n",
      "[f = 0, b = 2, a = 0, d = 1, g = 1, h = 0, c = 0, e = 2]\n",
      "90\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 2, h = 0, c = 0, e = 2]\n",
      "91\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 0, c = 0, e = 2]\n",
      "92\n",
      "[f = 0, b = 1, a = 0, d = 1, g = 1, h = 0, c = 2, e = 2]\n",
      "93\n",
      "[f = 2, b = 0, a = 2, d = 1, g = 1, h = 0, c = 2, e = 1]\n",
      "94\n",
      "[f = 2, b = 1, a = 2, d = 1, g = 1, h = 0, c = 2, e = 1]\n",
      "95\n",
      "[f = 2, b = 0, a = 2, d = 0, g = 0, h = 1, c = 2, e = 0]\n",
      "96\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 1, c = 1, e = 2]\n",
      "97\n",
      "[f = 0, b = 1, a = 0, d = 2, g = 2, h = 1, c = 0, e = 2]\n",
      "98\n",
      "[f = 2, b = 1, a = 2, d = 0, g = 0, h = 1, c = 2, e = 0]\n",
      "99\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 0, c = 1, e = 2]\n",
      "100\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 1, h = 0, c = 0, e = 2]\n",
      "101\n",
      "[f = 0, b = 1, a = 0, d = 2, g = 2, h = 0, c = 0, e = 2]\n",
      "102\n",
      "[f = 0, b = 1, a = 0, d = 2, g = 1, h = 0, c = 0, e = 2]\n",
      "103\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 2, h = 0, c = 1, e = 1]\n",
      "104\n",
      "[f = 0, b = 2, a = 0, d = 2, g = 1, h = 0, c = 0, e = 1]\n",
      "105\n",
      "[f = 0, b = 1, a = 0, d = 2, g = 2, h = 0, c = 0, e = 1]\n",
      "106\n",
      "[f = 0, b = 1, a = 0, d = 2, g = 1, h = 0, c = 0, e = 1]\n",
      "107\n",
      "[f = 0, b = 2, a = 1, d = 2, g = 2, h = 0, c = 1, e = 2]\n",
      "108\n",
      "[f = 0, b = 2, a = 1, d = 2, g = 1, h = 0, c = 0, e = 2]\n",
      "109\n",
      "[f = 0, b = 2, a = 1, d = 0, g = 2, h = 1, c = 1, e = 2]\n",
      "110\n",
      "[f = 0, b = 2, a = 1, d = 2, g = 2, h = 1, c = 1, e = 2]\n",
      "111\n",
      "[f = 2, b = 0, a = 1, d = 0, g = 0, h = 1, c = 2, e = 0]\n",
      "112\n",
      "[f = 2, b = 0, a = 1, d = 2, g = 0, h = 1, c = 1, e = 0]\n",
      "113\n",
      "[f = 2, b = 1, a = 0, d = 2, g = 1, h = 0, c = 0, e = 1]\n",
      "114\n"
     ]
    }
   ],
   "source": [
    "\n",
    "count=0\n",
    "while(s.check()==sat):\n",
    "    m=s.model()\n",
    "    print(m)\n",
    "    count+=1\n",
    "    print(count)\n",
    "    restrict=[]\n",
    "    for i in range(len(variate)):\n",
    "        restrict.append(variate[i]==m[m[i]])\n",
    "    s.add(Not(And(*restrict)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "id": "983cf087",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "114"
      ]
     },
     "execution_count": 76,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "72f14c9f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "52e36044",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "bed5da23",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "3f5c9198",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.environment import reset_env"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "82dbdcb5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d64a20fc",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.typing import INT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1bb3d74c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.oracles import get_logic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "951ab034",
   "metadata": {},
   "outputs": [],
   "source": [
    "var=[l for l in \"ABCD\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9d9ba5e6",
   "metadata": {},
   "outputs": [],
   "source": [
    "reset_env()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0ca86050",
   "metadata": {},
   "outputs": [],
   "source": [
    "smt_var=[Symbol(l,INT) for l in var]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "05220b7e",
   "metadata": {},
   "outputs": [],
   "source": [
    "domain=And([And(GE(v,Int(0)),LT(v,Int(6))) for v in smt_var])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b795e915",
   "metadata": {},
   "outputs": [],
   "source": [
    "is_sat(domain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "893bd6bf",
   "metadata": {},
   "outputs": [],
   "source": [
    "r1=NotEquals(smt_var[0],Int(0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "82fdcada",
   "metadata": {},
   "outputs": [],
   "source": [
    "r1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2d64f178",
   "metadata": {},
   "outputs": [],
   "source": [
    "r2=And(GE(smt_var[1],Int(2)),LT(smt_var[1],Int(6)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65924e23",
   "metadata": {},
   "outputs": [],
   "source": [
    "r2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "120fb218",
   "metadata": {},
   "outputs": [],
   "source": [
    "r3=NotEquals(smt_var[2],Int(3))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "71704a38",
   "metadata": {},
   "outputs": [],
   "source": [
    "r3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6c432325",
   "metadata": {},
   "outputs": [],
   "source": [
    "r4=And(NotEquals(smt_var[3],Int(2)),NotEquals(smt_var[3],Int(4)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c9825af0",
   "metadata": {},
   "outputs": [],
   "source": [
    "r4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5c7d5d0b",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(get_model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "89444a90",
   "metadata": {},
   "outputs": [],
   "source": [
    "def all_smt(formula, keys):\n",
    "    target_logic = get_logic(formula)\n",
    "    print(\"Target Logic: %s\" % target_logic)\n",
    "    with Solver(logic=target_logic) as solver:\n",
    "        solver.add_assertion(formula)\n",
    "        count=0\n",
    "        while solver.solve():\n",
    "            partial_model = [EqualsOrIff(k, solver.get_value(k)) for k in keys]\n",
    "            print(partial_model)\n",
    "            count+=1\n",
    "            solver.add_assertion(Not(And(partial_model)))\n",
    "        return count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ff231709",
   "metadata": {},
   "outputs": [],
   "source": [
    "count=all_smt(And(domain,r1,r2,r3,r4,Equals(smt_var[2],Int(2))),smt_var)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0a2b3a85",
   "metadata": {},
   "outputs": [],
   "source": [
    "count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4f727837",
   "metadata": {},
   "outputs": [],
   "source": [
    "help(NotEquals)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "853235bc",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d61e32c8",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7bfc174f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "aa00893c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from manim import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77bdb54e",
   "metadata": {},
   "outputs": [],
   "source": [
    "circle=Circle(2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0e8bfe4f",
   "metadata": {},
   "outputs": [],
   "source": [
    "%%manim -qm -v WARNING ShowClass\n",
    "class ShowClass(Scene):\n",
    "    def construct(self):\n",
    "        self.play(Create(circle))\n",
    "        self.wait()\n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e41e8c98",
   "metadata": {},
   "outputs": [
    {
     "ename": "ModuleNotFoundError",
     "evalue": "No module named 'sympy'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mModuleNotFoundError\u001b[0m                       Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01msympy\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n",
      "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'sympy'"
     ]
    }
   ],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "045d428f",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c20bf458",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import x,y,z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "b83eaeee",
   "metadata": {},
   "outputs": [],
   "source": [
    "eq=Eq(x/(y+1)+y/(x+1)+1/(x+y),4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8357a666",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{x}{y + 1} + \\frac{y}{x + 1} + \\frac{1}{x + y} = 4$"
      ],
      "text/plain": [
       "Eq(x/(y + 1) + y/(x + 1) + 1/(x + y), 4)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eq"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "d42c7011",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left\\{y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1, y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\left(- \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\left(- \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1, y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\left(- \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\left(- \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1\\right\\} \\setminus \\left\\{-1, - y\\right\\}$"
      ],
      "text/plain": [
       "Complement({y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1, y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(-1/2 - sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (-1/2 - sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1, y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(-1/2 + sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (-1/2 + sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1}, {-1, -y})"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "solveset(eq,x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "2a23c1dc",
   "metadata": {},
   "outputs": [],
   "source": [
    "answer=_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "c633c531",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c=answer.args[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "1ad20d31",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1$"
      ],
      "text/plain": [
       "y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "198ee963",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\left(- \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\left(- \\frac{1}{2} - \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1$"
      ],
      "text/plain": [
       "y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(-1/2 - sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (-1/2 - sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "e353e663",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle y - \\frac{9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9}{3 \\left(- \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}} - \\frac{\\left(- \\frac{1}{2} + \\frac{\\sqrt{3} i}{2}\\right) \\sqrt[3]{\\frac{27 y^{3}}{2} - \\frac{81 y^{2}}{2} - \\frac{81 y}{2} - \\frac{\\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right)}{2} + \\left(- 3 y - 3\\right)^{3} + \\frac{\\sqrt{- 4 \\left(9 y^{2} + 15 y + \\left(- 3 y - 3\\right)^{2} + 9\\right)^{3} + \\left(27 y^{3} - 81 y^{2} - 81 y - \\left(- 27 y - 27\\right) \\left(- 3 y^{2} - 5 y - 3\\right) + 2 \\left(- 3 y - 3\\right)^{3} + 27\\right)^{2}}}{2} + \\frac{27}{2}}}{3} + 1$"
      ],
      "text/plain": [
       "y - (9*y**2 + 15*y + (-3*y - 3)**2 + 9)/(3*(-1/2 + sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)) - (-1/2 + sqrt(3)*I/2)*(27*y**3/2 - 81*y**2/2 - 81*y/2 - (-27*y - 27)*(-3*y**2 - 5*y - 3)/2 + (-3*y - 3)**3 + sqrt(-4*(9*y**2 + 15*y + (-3*y - 3)**2 + 9)**3 + (27*y**3 - 81*y**2 - 81*y - (-27*y - 27)*(-3*y**2 - 5*y - 3) + 2*(-3*y - 3)**3 + 27)**2)/2 + 27/2)**(1/3)/3 + 1"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "2db157b8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{- 2 \\cdot \\sqrt[3]{2} \\cdot 3^{\\frac{2}{3}} y^{2} + y \\sqrt[3]{- 36 y^{3} - 153 y^{2} - 153 y + \\sqrt{3} \\sqrt{- 432 y^{6} - 1080 y^{5} + 171 y^{4} + 1642 y^{3} + 171 y^{2} - 1080 y - 432} - 36} - \\frac{11 \\cdot \\sqrt[3]{2} \\cdot 3^{\\frac{2}{3}} y}{3} - \\frac{\\sqrt[3]{12} \\left(- 36 y^{3} - 153 y^{2} - 153 y + \\sqrt{3} \\sqrt{- 432 y^{6} - 1080 y^{5} + 171 y^{4} + 1642 y^{3} + 171 y^{2} - 1080 y - 432} - 36\\right)^{\\frac{2}{3}}}{6} + \\sqrt[3]{- 36 y^{3} - 153 y^{2} - 153 y + \\sqrt{3} \\sqrt{- 432 y^{6} - 1080 y^{5} + 171 y^{4} + 1642 y^{3} + 171 y^{2} - 1080 y - 432} - 36} - 2 \\cdot \\sqrt[3]{2} \\cdot 3^{\\frac{2}{3}}}{\\sqrt[3]{- 36 y^{3} - 153 y^{2} - 153 y + \\sqrt{3} \\sqrt{- 432 y^{6} - 1080 y^{5} + 171 y^{4} + 1642 y^{3} + 171 y^{2} - 1080 y - 432} - 36}}$"
      ],
      "text/plain": [
       "(-2*2**(1/3)*3**(2/3)*y**2 + y*(-36*y**3 - 153*y**2 - 153*y + sqrt(3)*sqrt(-432*y**6 - 1080*y**5 + 171*y**4 + 1642*y**3 + 171*y**2 - 1080*y - 432) - 36)**(1/3) - 11*2**(1/3)*3**(2/3)*y/3 - 12**(1/3)*(-36*y**3 - 153*y**2 - 153*y + sqrt(3)*sqrt(-432*y**6 - 1080*y**5 + 171*y**4 + 1642*y**3 + 171*y**2 - 1080*y - 432) - 36)**(2/3)/6 + (-36*y**3 - 153*y**2 - 153*y + sqrt(3)*sqrt(-432*y**6 - 1080*y**5 + 171*y**4 + 1642*y**3 + 171*y**2 - 1080*y - 432) - 36)**(1/3) - 2*2**(1/3)*3**(2/3))/(-36*y**3 - 153*y**2 - 153*y + sqrt(3)*sqrt(-432*y**6 - 1080*y**5 + 171*y**4 + 1642*y**3 + 171*y**2 - 1080*y - 432) - 36)**(1/3)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nsimplify(simplify(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "59d8c946",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8f71dd20",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "b212fc11",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{x^{3} + x^{2} y + x^{2} + x y^{2} + 3 x y + x + y^{3} + y^{2} + y + 1}{\\left(x + 1\\right) \\left(x + y\\right) \\left(y + 1\\right)} = 4$"
      ],
      "text/plain": [
       "Eq((x**3 + x**2*y + x**2 + x*y**2 + 3*x*y + x + y**3 + y**2 + y + 1)/((x + 1)*(x + y)*(y + 1)), 4)"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "factor(eq)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "7aa85031",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{3} + x^{2} y + x^{2} + x y^{2} + 3 x y + x + y^{3} + y^{2} + y + 1$"
      ],
      "text/plain": [
       "x**3 + x**2*y + x**2 + x*y**2 + 3*x*y + x + y**3 + y**2 + y + 1"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fraction(_.lhs)[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "cc0ccb69",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=fraction(_.lhs)[0]-_.rhs*fraction(_.lhs)[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "d91a6e5a",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{3} + x^{2} y + x^{2} + x y^{2} + 3 x y + x + y^{3} + y^{2} + y - 4 \\left(x + 1\\right) \\left(x + y\\right) \\left(y + 1\\right) + 1$"
      ],
      "text/plain": [
       "x**3 + x**2*y + x**2 + x*y**2 + 3*x*y + x + y**3 + y**2 + y - 4*(x + 1)*(x + y)*(y + 1) + 1"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "f9d58b0e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{3} - 3 x^{2} y - 3 x^{2} - 3 x y^{2} - 5 x y - 3 x + y^{3} - 3 y^{2} - 3 y + 1$"
      ],
      "text/plain": [
       "x**3 - 3*x**2*y - 3*x**2 - 3*x*y**2 - 5*x*y - 3*x + y**3 - 3*y**2 - 3*y + 1"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "51ce036a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x^{3} - 3 x^{2} y - 3 x^{2} - 3 x y^{2} - 5 x y - 3 x + y^{3} - 3 y^{2} - 3 y + 1$"
      ],
      "text/plain": [
       "x**3 - 3*x**2*y - 3*x**2 - 3*x*y**2 - 5*x*y - 3*x + y**3 - 3*y**2 - 3*y + 1"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "collect(_,x-y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "bc3512a5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import m,n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "928c24ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "check=(m-1)**3-6*m+2-(6*m-1)*n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "f250d27b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle - 6 m - n \\left(6 m - 1\\right) + \\left(m - 1\\right)^{3} + 2$"
      ],
      "text/plain": [
       "-6*m - n*(6*m - 1) + (m - 1)**3 + 2"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "check"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "b87b37f2",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle 0$"
      ],
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expand(check.subs({m:x+y,n:x*y}))-expand(expr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 178,
   "id": "2bed7818",
   "metadata": {},
   "outputs": [],
   "source": [
    "expr=x/(y+z)+y/(x+z)+z/(x+y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 179,
   "id": "5c0565bd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{x}{y + z} + \\frac{y}{x + z} + \\frac{z}{x + y}$"
      ],
      "text/plain": [
       "x/(y + z) + y/(x + z) + z/(x + y)"
      ]
     },
     "execution_count": 179,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "expr"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "id": "cd0dab20",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\frac{x \\left(x + y\\right) \\left(x + z\\right) + y \\left(x + y\\right) \\left(y + z\\right) + z \\left(x + z\\right) \\left(y + z\\right)}{\\left(x + y\\right) \\left(x + z\\right) \\left(y + z\\right)}$"
      ],
      "text/plain": [
       "(x*(x + y)*(x + z) + y*(x + y)*(y + z) + z*(x + z)*(y + z))/((x + y)*(x + z)*(y + z))"
      ]
     },
     "execution_count": 183,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "together(expr).subs({x:a,y:b,z:c})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "bc5630e0",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import Symbol,Equals"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "id": "357c096d",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import Int"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "id": "7570b8b8",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.shortcuts import get_model,is_sat,GT,And"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "c44d9514",
   "metadata": {},
   "outputs": [],
   "source": [
    "from pysmt.typing import INT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "7ad11880",
   "metadata": {},
   "outputs": [],
   "source": [
    "a=Symbol(\"a\",INT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "7db88325",
   "metadata": {},
   "outputs": [],
   "source": [
    "b=Symbol(\"b\",INT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "e8ee0bac",
   "metadata": {},
   "outputs": [],
   "source": [
    "c=Symbol(\"c\",INT)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "id": "0c25d076",
   "metadata": {},
   "outputs": [],
   "source": [
    "domain=And([GT(l,Int(0)) for l in [a,b,c]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "id": "e304f0c7",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "((0 < a) & (0 < b) & (0 < c))"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "domain"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "e0aa5176",
   "metadata": {},
   "outputs": [],
   "source": [
    "problem=Equals(a/(b+c),Int(1)/Int(2))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "id": "a2103036",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "((a / (b + c)) = (1 / 2))\n"
     ]
    }
   ],
   "source": [
    "print(problem)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "id": "92f88d38",
   "metadata": {},
   "outputs": [],
   "source": [
    "formula=And(problem,domain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "id": "3f51876c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(((a / (b + c)) = (1 / 2)) & ((0 < a) & (0 < b) & (0 < c)))"
      ]
     },
     "execution_count": 69,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "formula"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "id": "02bf2061",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a := 1\n",
      "b := 1\n",
      "c := 1\n"
     ]
    }
   ],
   "source": [
    "print(get_model(formula))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "id": "42ac6043",
   "metadata": {},
   "outputs": [],
   "source": [
    "question=Equals(a/(b+c)+b/(a+c)+c/(b+a),Int(4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "id": "c81a0f82",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'((((a / (b + c)) + (b / (a + c))) + (c / (b + a))) = 4)'"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "question.serialize()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "id": "4697caf1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a := 1\n",
      "b := 1\n",
      "c := 8\n"
     ]
    }
   ],
   "source": [
    "print(get_model(And(question,domain)))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "id": "7b4e77d1",
   "metadata": {},
   "outputs": [],
   "source": [
    "from z3 import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "id": "d38cb1f7",
   "metadata": {},
   "outputs": [],
   "source": [
    "a,b,c=Ints(\"a b c\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 184,
   "id": "bc1d7a7b",
   "metadata": {},
   "outputs": [],
   "source": [
    "s=Solver()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "id": "0ea960de",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(a>0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "id": "0edc4521",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(b>0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "id": "98990365",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(c>0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 189,
   "id": "1e0fc6e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "s.add(a*(a+b)*(a+c)+b*(b+c)*(b+a)+c*(c+b)*(c+a)==4*(a+b)*(a+c)*(b+c))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "id": "ae3639ee",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(declare-fun a () Int)\n",
      "(declare-fun b () Int)\n",
      "(declare-fun c () Int)\n",
      "(assert (> a 0))\n",
      "(assert (> b 0))\n",
      "(assert (> c 0))\n",
      "(assert (= (+ (* a (+ a b) (+ a c)) (* b (+ b c) (+ b a)) (* c (+ c b) (+ c a)))\n",
      "   (* 4 (+ a b) (+ a c) (+ b c))))\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print(s.sexpr())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "id": "b90435b3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<b>unknown</b>"
      ],
      "text/plain": [
       "unknown"
      ]
     },
     "execution_count": 191,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.check()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 177,
   "id": "0b55fbd1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[a = 1, b = 4, c = 1]\n"
     ]
    }
   ],
   "source": [
    "print(s.model())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 192,
   "id": "6b244a5f",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests as re"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "id": "396ef56d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on function get in module requests.api:\n",
      "\n",
      "get(url, params=None, **kwargs)\n",
      "    Sends a GET request.\n",
      "    \n",
      "    :param url: URL for the new :class:`Request` object.\n",
      "    :param params: (optional) Dictionary, list of tuples or bytes to send\n",
      "        in the query string for the :class:`Request`.\n",
      "    :param \\*\\*kwargs: Optional arguments that ``request`` takes.\n",
      "    :return: :class:`Response <Response>` object\n",
      "    :rtype: requests.Response\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(re.get)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "id": "8bc29afa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import time\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "id": "19d4dfac",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1696329866.5168672"
      ]
     },
     "execution_count": 195,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "int(time.time())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 197,
   "id": "3a522cdb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "time.struct_time(tm_year=2023, tm_mon=10, tm_mday=3, tm_hour=18, tm_min=45, tm_sec=22, tm_wday=1, tm_yday=276, tm_isdst=0)"
      ]
     },
     "execution_count": 197,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.localtime(int(time.time()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.array([0, 1, 2, 3])\n",
    "y = np.array([-1, 0.2, 0.9, 2.1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[0., 1.],\n",
       "       [1., 1.],\n",
       "       [2., 1.],\n",
       "       [3., 1.]])"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = np.vstack([x, np.ones(len(x))]).T\n",
    "A\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "m, c = np.linalg.lstsq(A, y, rcond=None)[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0.9999999999999997, -0.9499999999999992)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "m,c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAi8AAAGdCAYAAADaPpOnAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAABLM0lEQVR4nO3deVhV1f7H8fcRAUEFZ8BEMVO0zCFMxTItb5bevE2/bmWOlaYNpua11G5ZVjZomZlTmjhrV9RrWqZXBSuHFLFJ0wbnIGdQMcb9+2MFhSCCcNjncD6v5znPdW325nw57Ssf11p7LYdlWRYiIiIibqKc3QWIiIiIFIXCi4iIiLgVhRcRERFxKwovIiIi4lYUXkRERMStKLyIiIiIW1F4EREREbei8CIiIiJupbzdBZS0rKwsfv31VypXrozD4bC7HBERESkEy7I4c+YMtWvXply5gvtWylx4+fXXXwkNDbW7DBEREbkMhw4dok6dOgWeU+bCS+XKlQHzwwcEBNhcjYiIiBRGcnIyoaGhOb/HC1Lmwkv2UFFAQIDCi4iIiJspzJQPTdgVERERt6LwIiIiIm5F4UVERETcSpmb81IYlmWRkZFBZmam3aWIC/Py8qJ8+fJ65F5ExMV4XHhJS0sjISGBlJQUu0sRN+Dv709ISAg+Pj52lyIiIn/wqPCSlZXFvn378PLyonbt2vj4+Ohf1ZIvy7JIS0vj2LFj7Nu3j4YNG15y0SQRkbLOsixOpaRzLjWDir7lqervbcvvUY8KL2lpaWRlZREaGoq/v7/d5YiL8/Pzw9vbmwMHDpCWlkaFChXsLklExBZJ59OJjjvM7E37OXDyz5GLetX86d0ujHsj6hDo511q9XhUeMlWEv+CdpX0Kc6l3hYR8XSxe48xcF4c59PyzhM9eDKFMSt3MW7NHqb0iKBDo5qlUpNHhpficLX0KSIi4iyxe4/Rd9ZXWICVz9ezj51Pz6TvrK+Y1bd1qQQY/bOyCGL3H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CAwNzggtA27ZtCQwMZNOmTQVeGxMTQ61atWjUqBH9+vXj6NGjFz03NTWV5OTkXC8pBTt2QESECS4OBzz/PGzcqOAiIiJO57TwkpiYSK1atfIcr1WrFomJiRe9rkuXLsyfP5/169czfvx4tm3bxi233EJqamq+548dOzZnTk1gYCChoaEl9jNIPrKyzCq5bdvC3r1Qpw5s2GAm6Xp7212diIh4gCKHl9GjR+eZUHvha/v27QA4HI4811uWle/xbPfffz9///vfadq0Kd26dePTTz9l7969rFq1Kt/zR4wYQVJSUs7r0KFDRf2RpLASE6FLFxg2DNLT4Z574OuvoUMHuysTEREPUuQ5L08++SQPPPBAgeeEhYXxzTff8Ntvv+X52rFjxwgKCir0+4WEhFCvXj1+/PHHfL/u6+uLr69vob+fXKZVq8xO0MeOmWX9330XHn3UDBmJiIiUoiKHlxo1alCjEDsAR0ZGkpSUxFdffUXr1q0B2Lp1K0lJSbRr167Q73fixAkOHTpESEhIUUuVkvD77/DsszBxomk3b27WbmnSxN66RETEYzltzkuTJk24/fbb6devH1u2bGHLli3069ePO+64I9eTRo0bN2bZsmUAnD17lmHDhrF582b2799PTEwM3bp1o0aNGtx9993OKlUuZtcuaNPmz+AyeDBs2aLgIiIitnLqInXz58/n2muvpXPnznTu3JlmzZoxd+7cXOfs2bOHpKQkALy8vPj222+58847adSoEb1796ZRo0Zs3ryZypUrO7NU+SvLgmnToFUr+OYbqFnTDBu98w5UqGB3dSIi4uEclmVZdhdRkpKTkwkMDCQpKYmAgAC7y3E/J05Av37wR28YnTvD7NmgdXdERMSJivL7Wxszyp9iYsyclmXLzGPP48fDp58quIiIiEtReBHz2POoUXDLLXDkCISHw9atMHQolNMtIiIirkW7Snu6X34x+xBt3WrajzxiHoOuWNHeukRERC5C/6z2ZPPnQ4sWJrhUqWI2WJwxQ8FFRERcmnpePFFyMjz5JGQ/+XXjjSbI1K1rb10iIiKFoJ4XT/PVV9CypQku5crBSy+ZvYkUXERExE2o58VTZGbCm2/CCy9ARgbUq2d6W264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zzf/nlF8vf398aMmSItWvXLmvmzJmWt7e3tWTJErt+hFJT1M/qnXfesZYtW2bt3bvX+u6776znnnvOAqzo6Gi7foRSc+bMGSs+Pt6Kj4+3AOvtt9+24uPjrQMHDliWpfvqr4r6WXnyfTVw4EArMDDQiomJsRISEnJeKSkpOefo3jIu57Py1HtrxIgR1saNG619+/ZZ33zzjTVy5EirXLly1po1ayzLcp17SuHlAu+//75Vr149y8fHx7ruuutyPUrXu3dvq0OHDrnOj4mJsVq2bGn5+PhYYWFh1pQpU0q5YvsU5bN64403rAYNGlgVKlSwqlatat14443WqlWrbKi69GU/cnnhq3fv3pZl6b76q6J+Vp58X+X3OQHWrFmzcs7RvWVczmflqffWww8/nPP3es2aNa1OnTrlBBfLcp17ymFZf8ysEREREXEDmvMiIiIibkXhRURERNyKwouIiIi4FYUXERERcSsKLyIiIuJWFF5ERETErSi8iIiIiFtReBERERG3ovAiIiIibkXhRURERNyKwouIiIi4FYUXERERcSv/DzQQbOgNE5hxAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 640x480 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "_ = plt.plot(x, y, 'o', label='Original data', markersize=10)\n",
    "_ = plt.plot(x, m*x + c, 'r', label='Fitted line')\n",
    "_ = plt.legend()\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.abc import x,y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sympy.core.relational.StrictLessThan"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(x<3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from z3 import *"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9134ab29",
   "metadata": {},
   "source": [
    "# 学习sympy的源码"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "fd4bc958",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'/home/huang/sympy_work_code'"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%pwd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "de94f9ed",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sys import path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "06e0edf9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['/home/huang/sympy_work_code',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python312.zip',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12/lib-dynload',\n",
       " '',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12/site-packages']"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6d2f10ae",
   "metadata": {},
   "outputs": [],
   "source": [
    "path.append(\"/home/huang/Documents/sympy\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "8675491d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['/home/huang/sympy_work_code',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python312.zip',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12/lib-dynload',\n",
       " '',\n",
       " '/home/huang/anaconda3/envs/learn-sympy/lib/python3.12/site-packages',\n",
       " '/home/huang/Documents/sympy']"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "8cf3ed44",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.geometry.point import Point"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "c63cf440",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "14250ef1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\left(x + 2\\right) \\left(x + 3\\right)$"
      ],
      "text/plain": [
       "(x + 2)*(x + 3)"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(x+2)*(x+3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "dff0036b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "sympy.core.mul.Mul"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(_)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "c2c841c9",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Something is happening before the function is called.\n",
      "8\n"
     ]
    }
   ],
   "source": [
    "def original_function(x, y):\n",
    "    return x + y\n",
    "\n",
    "def wrapper(func):\n",
    "    def wrapped_function(*args, **kwargs):\n",
    "        print(\"Something is happening before the function is called.\")\n",
    "        result = func(*args, **kwargs)\n",
    "        print(\"Something is happening after the function is called.\")\n",
    "        return result\n",
    "    return wrapped_function\n",
    "\n",
    "# 使用包装函数\n",
    "original_function = wrapper(original_function)\n",
    "\n",
    "print(original_function(5, 3))  # 输出: 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "62382e6c",
   "metadata": {},
   "outputs": [],
   "source": [
    "from functools import  reduce\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "1bceecc8",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on SingletonRegistry in module sympy.core.singleton object:\n",
      "\n",
      "class SingletonRegistry(sympy.core.core.Registry)\n",
      " |  The registry for the singleton classes (accessible as ``S``).\n",
      " |\n",
      " |  Explanation\n",
      " |  ===========\n",
      " |\n",
      " |  This class serves as two separate things.\n",
      " |\n",
      " |  The first thing it is is the ``SingletonRegistry``. Several classes in\n",
      " |  SymPy appear so often that they are singletonized, that is, using some\n",
      " |  metaprogramming they are made so that they can only be instantiated once\n",
      " |  (see the :class:`sympy.core.singleton.Singleton` class for details). For\n",
      " |  instance, every time you create ``Integer(0)``, this will return the same\n",
      " |  instance, :class:`sympy.core.numbers.Zero`. All singleton instances are\n",
      " |  attributes of the ``S`` object, so ``Integer(0)`` can also be accessed as\n",
      " |  ``S.Zero``.\n",
      " |\n",
      " |  Singletonization offers two advantages: it saves memory, and it allows\n",
      " |  fast comparison. It saves memory because no matter how many times the\n",
      " |  singletonized objects appear in expressions in memory, they all point to\n",
      " |  the same single instance in memory. The fast comparison comes from the\n",
      " |  fact that you can use ``is`` to compare exact instances in Python\n",
      " |  (usually, you need to use ``==`` to compare things). ``is`` compares\n",
      " |  objects by memory address, and is very fast.\n",
      " |\n",
      " |  Examples\n",
      " |  ========\n",
      " |\n",
      " |  >>> from sympy import S, Integer\n",
      " |  >>> a = Integer(0)\n",
      " |  >>> a is S.Zero\n",
      " |  True\n",
      " |\n",
      " |  For the most part, the fact that certain objects are singletonized is an\n",
      " |  implementation detail that users should not need to worry about. In SymPy\n",
      " |  library code, ``is`` comparison is often used for performance purposes\n",
      " |  The primary advantage of ``S`` for end users is the convenient access to\n",
      " |  certain instances that are otherwise difficult to type, like ``S.Half``\n",
      " |  (instead of ``Rational(1, 2)``).\n",
      " |\n",
      " |  When using ``is`` comparison, make sure the argument is sympified. For\n",
      " |  instance,\n",
      " |\n",
      " |  >>> x = 0\n",
      " |  >>> x is S.Zero\n",
      " |  False\n",
      " |\n",
      " |  This problem is not an issue when using ``==``, which is recommended for\n",
      " |  most use-cases:\n",
      " |\n",
      " |  >>> 0 == S.Zero\n",
      " |  True\n",
      " |\n",
      " |  The second thing ``S`` is is a shortcut for\n",
      " |  :func:`sympy.core.sympify.sympify`. :func:`sympy.core.sympify.sympify` is\n",
      " |  the function that converts Python objects such as ``int(1)`` into SymPy\n",
      " |  objects such as ``Integer(1)``. It also converts the string form of an\n",
      " |  expression into a SymPy expression, like ``sympify(\"x**2\")`` ->\n",
      " |  ``Symbol(\"x\")**2``. ``S(1)`` is the same thing as ``sympify(1)``\n",
      " |  (basically, ``S.__call__`` has been defined to call ``sympify``).\n",
      " |\n",
      " |  This is for convenience, since ``S`` is a single letter. It's mostly\n",
      " |  useful for defining rational numbers. Consider an expression like ``x +\n",
      " |  1/2``. If you enter this directly in Python, it will evaluate the ``1/2``\n",
      " |  and give ``0.5``, because both arguments are ints (see also\n",
      " |  :ref:`tutorial-gotchas-final-notes`). However, in SymPy, you usually want\n",
      " |  the quotient of two integers to give an exact rational number. The way\n",
      " |  Python's evaluation works, at least one side of an operator needs to be a\n",
      " |  SymPy object for the SymPy evaluation to take over. You could write this\n",
      " |  as ``x + Rational(1, 2)``, but this is a lot more typing. A shorter\n",
      " |  version is ``x + S(1)/2``. Since ``S(1)`` returns ``Integer(1)``, the\n",
      " |  division will return a ``Rational`` type, since it will call\n",
      " |  ``Integer.__truediv__``, which knows how to return a ``Rational``.\n",
      " |\n",
      " |  Method resolution order:\n",
      " |      SingletonRegistry\n",
      " |      sympy.core.core.Registry\n",
      " |      builtins.object\n",
      " |\n",
      " |  Methods defined here:\n",
      " |\n",
      " |  __getattr__(self, name)\n",
      " |      Python calls __getattr__ if no attribute of that name was installed\n",
      " |      yet.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      This __getattr__ checks whether a class with the requested name was\n",
      " |      already registered but not installed; if no, raises an AttributeError.\n",
      " |      Otherwise, retrieves the class, calculates its singleton value, installs\n",
      " |      it as an attribute of the given name, and unregisters the class.\n",
      " |\n",
      " |  __init__(self)\n",
      " |      Initialize self.  See help(type(self)) for accurate signature.\n",
      " |\n",
      " |  __repr__(self)\n",
      " |      Return repr(self).\n",
      " |\n",
      " |  register(self, cls)\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |\n",
      " |  __call__ = sympify(a, locals=None, convert_xor=True, strict=False, rational=False, evaluate=None) from sympy.core.sympify\n",
      " |      Converts an arbitrary expression to a type that can be used inside SymPy.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      It will convert Python ints into instances of :class:`~.Integer`, floats\n",
      " |      into instances of :class:`~.Float`, etc. It is also able to coerce\n",
      " |      symbolic expressions which inherit from :class:`~.Basic`. This can be\n",
      " |      useful in cooperation with SAGE.\n",
      " |\n",
      " |      .. warning::\n",
      " |          Note that this function uses ``eval``, and thus shouldn't be used on\n",
      " |          unsanitized input.\n",
      " |\n",
      " |      If the argument is already a type that SymPy understands, it will do\n",
      " |      nothing but return that value. This can be used at the beginning of a\n",
      " |      function to ensure you are working with the correct type.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sympify\n",
      " |\n",
      " |      >>> sympify(2).is_integer\n",
      " |      True\n",
      " |      >>> sympify(2).is_real\n",
      " |      True\n",
      " |\n",
      " |      >>> sympify(2.0).is_real\n",
      " |      True\n",
      " |      >>> sympify(\"2.0\").is_real\n",
      " |      True\n",
      " |      >>> sympify(\"2e-45\").is_real\n",
      " |      True\n",
      " |\n",
      " |      If the expression could not be converted, a SympifyError is raised.\n",
      " |\n",
      " |      >>> sympify(\"x***2\")\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      SympifyError: SympifyError: \"could not parse 'x***2'\"\n",
      " |\n",
      " |      Locals\n",
      " |      ------\n",
      " |\n",
      " |      The sympification happens with access to everything that is loaded\n",
      " |      by ``from sympy import *``; anything used in a string that is not\n",
      " |      defined by that import will be converted to a symbol. In the following,\n",
      " |      the ``bitcount`` function is treated as a symbol and the ``O`` is\n",
      " |      interpreted as the :class:`~.Order` object (used with series) and it raises\n",
      " |      an error when used improperly:\n",
      " |\n",
      " |      >>> s = 'bitcount(42)'\n",
      " |      >>> sympify(s)\n",
      " |      bitcount(42)\n",
      " |      >>> sympify(\"O(x)\")\n",
      " |      O(x)\n",
      " |      >>> sympify(\"O + 1\")\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      TypeError: unbound method...\n",
      " |\n",
      " |      In order to have ``bitcount`` be recognized it can be imported into a\n",
      " |      namespace dictionary and passed as locals:\n",
      " |\n",
      " |      >>> ns = {}\n",
      " |      >>> exec('from sympy.core.evalf import bitcount', ns)\n",
      " |      >>> sympify(s, locals=ns)\n",
      " |      6\n",
      " |\n",
      " |      In order to have the ``O`` interpreted as a Symbol, identify it as such\n",
      " |      in the namespace dictionary. This can be done in a variety of ways; all\n",
      " |      three of the following are possibilities:\n",
      " |\n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> ns[\"O\"] = Symbol(\"O\")  # method 1\n",
      " |      >>> exec('from sympy.abc import O', ns)  # method 2\n",
      " |      >>> ns.update(dict(O=Symbol(\"O\")))  # method 3\n",
      " |      >>> sympify(\"O + 1\", locals=ns)\n",
      " |      O + 1\n",
      " |\n",
      " |      If you want *all* single-letter and Greek-letter variables to be symbols\n",
      " |      then you can use the clashing-symbols dictionaries that have been defined\n",
      " |      there as private variables: ``_clash1`` (single-letter variables),\n",
      " |      ``_clash2`` (the multi-letter Greek names) or ``_clash`` (both single and\n",
      " |      multi-letter names that are defined in ``abc``).\n",
      " |\n",
      " |      >>> from sympy.abc import _clash1\n",
      " |      >>> set(_clash1)  # if this fails, see issue #23903\n",
      " |      {'E', 'I', 'N', 'O', 'Q', 'S'}\n",
      " |      >>> sympify('I & Q', _clash1)\n",
      " |      I & Q\n",
      " |\n",
      " |      Strict\n",
      " |      ------\n",
      " |\n",
      " |      If the option ``strict`` is set to ``True``, only the types for which an\n",
      " |      explicit conversion has been defined are converted. In the other\n",
      " |      cases, a SympifyError is raised.\n",
      " |\n",
      " |      >>> print(sympify(None))\n",
      " |      None\n",
      " |      >>> sympify(None, strict=True)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      SympifyError: SympifyError: None\n",
      " |\n",
      " |      .. deprecated:: 1.6\n",
      " |\n",
      " |         ``sympify(obj)`` automatically falls back to ``str(obj)`` when all\n",
      " |         other conversion methods fail, but this is deprecated. ``strict=True``\n",
      " |         will disable this deprecated behavior. See\n",
      " |         :ref:`deprecated-sympify-string-fallback`.\n",
      " |\n",
      " |      Evaluation\n",
      " |      ----------\n",
      " |\n",
      " |      If the option ``evaluate`` is set to ``False``, then arithmetic and\n",
      " |      operators will be converted into their SymPy equivalents and the\n",
      " |      ``evaluate=False`` option will be added. Nested ``Add`` or ``Mul`` will\n",
      " |      be denested first. This is done via an AST transformation that replaces\n",
      " |      operators with their SymPy equivalents, so if an operand redefines any\n",
      " |      of those operations, the redefined operators will not be used. If\n",
      " |      argument a is not a string, the mathematical expression is evaluated\n",
      " |      before being passed to sympify, so adding ``evaluate=False`` will still\n",
      " |      return the evaluated result of expression.\n",
      " |\n",
      " |      >>> sympify('2**2 / 3 + 5')\n",
      " |      19/3\n",
      " |      >>> sympify('2**2 / 3 + 5', evaluate=False)\n",
      " |      2**2/3 + 5\n",
      " |      >>> sympify('4/2+7', evaluate=True)\n",
      " |      9\n",
      " |      >>> sympify('4/2+7', evaluate=False)\n",
      " |      4/2 + 7\n",
      " |      >>> sympify(4/2+7, evaluate=False)\n",
      " |      9.00000000000000\n",
      " |\n",
      " |      Extending\n",
      " |      ---------\n",
      " |\n",
      " |      To extend ``sympify`` to convert custom objects (not derived from ``Basic``),\n",
      " |      just define a ``_sympy_`` method to your class. You can do that even to\n",
      " |      classes that you do not own by subclassing or adding the method at runtime.\n",
      " |\n",
      " |      >>> from sympy import Matrix\n",
      " |      >>> class MyList1(object):\n",
      " |      ...     def __iter__(self):\n",
      " |      ...         yield 1\n",
      " |      ...         yield 2\n",
      " |      ...         return\n",
      " |      ...     def __getitem__(self, i): return list(self)[i]\n",
      " |      ...     def _sympy_(self): return Matrix(self)\n",
      " |      >>> sympify(MyList1())\n",
      " |      Matrix([\n",
      " |      [1],\n",
      " |      [2]])\n",
      " |\n",
      " |      If you do not have control over the class definition you could also use the\n",
      " |      ``converter`` global dictionary. The key is the class and the value is a\n",
      " |      function that takes a single argument and returns the desired SymPy\n",
      " |      object, e.g. ``converter[MyList] = lambda x: Matrix(x)``.\n",
      " |\n",
      " |      >>> class MyList2(object):   # XXX Do not do this if you control the class!\n",
      " |      ...     def __iter__(self):  #     Use _sympy_!\n",
      " |      ...         yield 1\n",
      " |      ...         yield 2\n",
      " |      ...         return\n",
      " |      ...     def __getitem__(self, i): return list(self)[i]\n",
      " |      >>> from sympy.core.sympify import converter\n",
      " |      >>> converter[MyList2] = lambda x: Matrix(x)\n",
      " |      >>> sympify(MyList2())\n",
      " |      Matrix([\n",
      " |      [1],\n",
      " |      [2]])\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      The keywords ``rational`` and ``convert_xor`` are only used\n",
      " |      when the input is a string.\n",
      " |\n",
      " |      convert_xor\n",
      " |      -----------\n",
      " |\n",
      " |      >>> sympify('x^y',convert_xor=True)\n",
      " |      x**y\n",
      " |      >>> sympify('x^y',convert_xor=False)\n",
      " |      x ^ y\n",
      " |\n",
      " |      rational\n",
      " |      --------\n",
      " |\n",
      " |      >>> sympify('0.1',rational=False)\n",
      " |      0.1\n",
      " |      >>> sympify('0.1',rational=True)\n",
      " |      1/10\n",
      " |\n",
      " |      Sometimes autosimplification during sympification results in expressions\n",
      " |      that are very different in structure than what was entered. Until such\n",
      " |      autosimplification is no longer done, the ``kernS`` function might be of\n",
      " |      some use. In the example below you can see how an expression reduces to\n",
      " |      $-1$ by autosimplification, but does not do so when ``kernS`` is used.\n",
      " |\n",
      " |      >>> from sympy.core.sympify import kernS\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> -2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1\n",
      " |      -1\n",
      " |      >>> s = '-2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1'\n",
      " |      >>> sympify(s)\n",
      " |      -1\n",
      " |      >>> kernS(s)\n",
      " |      -2*(-(-x + 1/x)/(x*(x - 1/x)**2) - 1/(x*(x - 1/x))) - 1\n",
      " |\n",
      " |      Parameters\n",
      " |      ==========\n",
      " |\n",
      " |      a :\n",
      " |          - any object defined in SymPy\n",
      " |          - standard numeric Python types: ``int``, ``long``, ``float``, ``Decimal``\n",
      " |          - strings (like ``\"0.09\"``, ``\"2e-19\"`` or ``'sin(x)'``)\n",
      " |          - booleans, including ``None`` (will leave ``None`` unchanged)\n",
      " |          - dicts, lists, sets or tuples containing any of the above\n",
      " |\n",
      " |      convert_xor : bool, optional\n",
      " |          If true, treats ``^`` as exponentiation.\n",
      " |          If False, treats ``^`` as XOR itself.\n",
      " |          Used only when input is a string.\n",
      " |\n",
      " |      locals : any object defined in SymPy, optional\n",
      " |          In order to have strings be recognized it can be imported\n",
      " |          into a namespace dictionary and passed as locals.\n",
      " |\n",
      " |      strict : bool, optional\n",
      " |          If the option strict is set to ``True``, only the types for which\n",
      " |          an explicit conversion has been defined are converted. In the\n",
      " |          other cases, a SympifyError is raised.\n",
      " |\n",
      " |      rational : bool, optional\n",
      " |          If ``True``, converts floats into :class:`~.Rational`.\n",
      " |          If ``False``, it lets floats remain as it is.\n",
      " |          Used only when input is a string.\n",
      " |\n",
      " |      evaluate : bool, optional\n",
      " |          If False, then arithmetic and operators will be converted into\n",
      " |          their SymPy equivalents. If True the expression will be evaluated\n",
      " |          and the result will be returned.\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |\n",
      " |  Catalan = Catalan\n",
      " |\n",
      " |  ComplexInfinity = zoo\n",
      " |\n",
      " |  Complexes = Complexes\n",
      " |\n",
      " |  EmptySequence = EmptySequence\n",
      " |\n",
      " |  EmptySet = EmptySet\n",
      " |\n",
      " |  EulerGamma = EulerGamma\n",
      " |\n",
      " |  Exp1 = E\n",
      " |\n",
      " |  GoldenRatio = GoldenRatio\n",
      " |\n",
      " |  Half = 1/2\n",
      " |\n",
      " |  IdentityFunction = Lambda(_x, _x)\n",
      " |\n",
      " |  ImaginaryUnit = I\n",
      " |\n",
      " |  Infinity = oo\n",
      " |\n",
      " |  Integers = Integers\n",
      " |\n",
      " |  NaN = nan\n",
      " |\n",
      " |  Naturals = Naturals\n",
      " |\n",
      " |  Naturals0 = Naturals0\n",
      " |\n",
      " |  NegativeInfinity = -oo\n",
      " |\n",
      " |  NegativeOne = -1\n",
      " |\n",
      " |  One = 1\n",
      " |\n",
      " |  Pi = pi\n",
      " |\n",
      " |  Rationals = Rationals\n",
      " |\n",
      " |  Reals = Reals\n",
      " |\n",
      " |  TribonacciConstant = TribonacciConstant\n",
      " |\n",
      " |  UniversalSet = UniversalSet\n",
      " |\n",
      " |  Zero = 0\n",
      " |\n",
      " |  false = False\n",
      " |\n",
      " |  true = True\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.core.Registry:\n",
      " |\n",
      " |  __delattr__(self, name)\n",
      " |      Implement delattr(self, name).\n",
      " |\n",
      " |  __setattr__(self, name, obj)\n",
      " |      Implement setattr(self, name, value).\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(S)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "eae081a4",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import Add, Symbol\n",
    "\n",
    "class MyAdd:\n",
    "    def __init__(self, args):\n",
    "        self.args = args\n",
    "\n",
    "    def __add__(self, other):\n",
    "        # 假设 'other' 也是一个 MyAdd 实例或数值\n",
    "        new_args = list(self.args)\n",
    "        for arg in other.args:\n",
    "            new_args.append(arg)\n",
    "        return MyAdd(new_args)\n",
    "\n",
    "x = Symbol('x')\n",
    "y = Symbol('y')\n",
    "\n",
    "a = MyAdd([x, y])\n",
    "b = MyAdd([y, 3])\n",
    "\n",
    "result = a + b  # 这将调用 __add__ 方法\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "baf9125d",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[x, y, y, 3]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result.args"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "4fe204fe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "sin(x)"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "ef359982",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Help on class sin in module sympy.functions.elementary.trigonometric:\n",
      "\n",
      "class sin(TrigonometricFunction)\n",
      " |  sin(arg)\n",
      " |\n",
      " |  The sine function.\n",
      " |\n",
      " |  Returns the sine of x (measured in radians).\n",
      " |\n",
      " |  Explanation\n",
      " |  ===========\n",
      " |\n",
      " |  This function will evaluate automatically in the\n",
      " |  case $x/\\pi$ is some rational number [4]_.  For example,\n",
      " |  if $x$ is a multiple of $\\pi$, $\\pi/2$, $\\pi/3$, $\\pi/4$, and $\\pi/6$.\n",
      " |\n",
      " |  Examples\n",
      " |  ========\n",
      " |\n",
      " |  >>> from sympy import sin, pi\n",
      " |  >>> from sympy.abc import x\n",
      " |  >>> sin(x**2).diff(x)\n",
      " |  2*x*cos(x**2)\n",
      " |  >>> sin(1).diff(x)\n",
      " |  0\n",
      " |  >>> sin(pi)\n",
      " |  0\n",
      " |  >>> sin(pi/2)\n",
      " |  1\n",
      " |  >>> sin(pi/6)\n",
      " |  1/2\n",
      " |  >>> sin(pi/12)\n",
      " |  -sqrt(2)/4 + sqrt(6)/4\n",
      " |\n",
      " |\n",
      " |  See Also\n",
      " |  ========\n",
      " |\n",
      " |  csc, cos, sec, tan, cot\n",
      " |  asin, acsc, acos, asec, atan, acot, atan2\n",
      " |\n",
      " |  References\n",
      " |  ==========\n",
      " |\n",
      " |  .. [1] https://en.wikipedia.org/wiki/Trigonometric_functions\n",
      " |  .. [2] https://dlmf.nist.gov/4.14\n",
      " |  .. [3] https://functions.wolfram.com/ElementaryFunctions/Sin\n",
      " |  .. [4] https://mathworld.wolfram.com/TrigonometryAngles.html\n",
      " |\n",
      " |  Method resolution order:\n",
      " |      sin\n",
      " |      TrigonometricFunction\n",
      " |      sympy.core.function.Function\n",
      " |      sympy.core.function.Application\n",
      " |      sympy.core.expr.Expr\n",
      " |      sympy.core.basic.Basic\n",
      " |      sympy.printing.defaults.Printable\n",
      " |      sympy.core.evalf.EvalfMixin\n",
      " |      builtins.object\n",
      " |\n",
      " |  Methods defined here:\n",
      " |\n",
      " |  as_real_imag(self, deep=True, **hints)\n",
      " |      Performs complex expansion on 'self' and returns a tuple\n",
      " |      containing collected both real and imaginary parts. This\n",
      " |      method cannot be confused with re() and im() functions,\n",
      " |      which does not perform complex expansion at evaluation.\n",
      " |\n",
      " |      However it is possible to expand both re() and im()\n",
      " |      functions and get exactly the same results as with\n",
      " |      a single call to this function.\n",
      " |\n",
      " |      >>> from sympy import symbols, I\n",
      " |\n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |\n",
      " |      >>> (x + y*I).as_real_imag()\n",
      " |      (x, y)\n",
      " |\n",
      " |      >>> from sympy.abc import z, w\n",
      " |\n",
      " |      >>> (z + w*I).as_real_imag()\n",
      " |      (re(z) - im(w), re(w) + im(z))\n",
      " |\n",
      " |  fdiff(self, argindex=1)\n",
      " |      Returns the first derivative of the function.\n",
      " |\n",
      " |  period(self, symbol=None)\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods defined here:\n",
      " |\n",
      " |  eval(arg)\n",
      " |      Returns a canonical form of cls applied to arguments args.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      The ``eval()`` method is called when the class ``cls`` is about to be\n",
      " |      instantiated and it should return either some simplified instance\n",
      " |      (possible of some other class), or if the class ``cls`` should be\n",
      " |      unmodified, return None.\n",
      " |\n",
      " |      Examples of ``eval()`` for the function \"sign\"\n",
      " |\n",
      " |      .. code-block:: python\n",
      " |\n",
      " |          @classmethod\n",
      " |          def eval(cls, arg):\n",
      " |              if arg is S.NaN:\n",
      " |                  return S.NaN\n",
      " |              if arg.is_zero: return S.Zero\n",
      " |              if arg.is_positive: return S.One\n",
      " |              if arg.is_negative: return S.NegativeOne\n",
      " |              if isinstance(arg, Mul):\n",
      " |                  coeff, terms = arg.as_coeff_Mul(rational=True)\n",
      " |                  if coeff is not S.One:\n",
      " |                      return cls(coeff) * cls(terms)\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods defined here:\n",
      " |\n",
      " |  taylor_term(n, x, *previous_terms)\n",
      " |      General method for the taylor term.\n",
      " |\n",
      " |      This method is slow, because it differentiates n-times. Subclasses can\n",
      " |      redefine it to make it faster by using the \"previous_terms\".\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes defined here:\n",
      " |\n",
      " |  __annotations__ = {}\n",
      " |\n",
      " |  default_assumptions = {}\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from TrigonometricFunction:\n",
      " |\n",
      " |  unbranched = True\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.function.Function:\n",
      " |\n",
      " |  as_base_exp(self)\n",
      " |      Returns the method as the 2-tuple (base, exponent).\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.function.Function:\n",
      " |\n",
      " |  class_key()\n",
      " |      Nice order of classes.\n",
      " |\n",
      " |  is_singular(a)\n",
      " |      Tests whether the argument is an essential singularity\n",
      " |      or a branch point, or the functions is non-holomorphic.\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Static methods inherited from sympy.core.function.Function:\n",
      " |\n",
      " |  __new__(cls, *args, **options)\n",
      " |      Create and return a new object.  See help(type) for accurate signature.\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.function.Application:\n",
      " |\n",
      " |  func\n",
      " |      The top-level function in an expression.\n",
      " |\n",
      " |      The following should hold for all objects::\n",
      " |\n",
      " |          >> x == x.func(*x.args)\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> a = 2*x\n",
      " |      >>> a.func\n",
      " |      <class 'sympy.core.mul.Mul'>\n",
      " |      >>> a.args\n",
      " |      (2, x)\n",
      " |      >>> a.func(*a.args)\n",
      " |      2*x\n",
      " |      >>> a == a.func(*a.args)\n",
      " |      True\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data descriptors inherited from sympy.core.function.Application:\n",
      " |\n",
      " |  __dict__\n",
      " |      dictionary for instance variables\n",
      " |\n",
      " |  __weakref__\n",
      " |      list of weak references to the object\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.function.Application:\n",
      " |\n",
      " |  is_Function = True\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.expr.Expr:\n",
      " |\n",
      " |  __abs__(self) -> 'Expr'\n",
      " |\n",
      " |  __add__(self, other)\n",
      " |\n",
      " |  __complex__(self)\n",
      " |\n",
      " |  __divmod__(self, other)\n",
      " |\n",
      " |  __float__(self)\n",
      " |\n",
      " |  __floordiv__(self, other)\n",
      " |\n",
      " |  __format__(self, format_spec: 'str')\n",
      " |      Default object formatter.\n",
      " |\n",
      " |      Return str(self) if format_spec is empty. Raise TypeError otherwise.\n",
      " |\n",
      " |  __ge__(self, other)\n",
      " |      Return self>=value.\n",
      " |\n",
      " |  __gt__(self, other)\n",
      " |      Return self>value.\n",
      " |\n",
      " |  __int__(self)\n",
      " |\n",
      " |  __le__(self, other)\n",
      " |      Return self<=value.\n",
      " |\n",
      " |  __lt__(self, other)\n",
      " |      Return self<value.\n",
      " |\n",
      " |  __mod__(self, other)\n",
      " |\n",
      " |  __mul__(self, other)\n",
      " |\n",
      " |  __neg__(self)\n",
      " |\n",
      " |  __pos__(self)\n",
      " |\n",
      " |  __pow__(self, other, mod=None) -> 'Expr'\n",
      " |\n",
      " |  __radd__(self, other)\n",
      " |\n",
      " |  __rdivmod__(self, other)\n",
      " |\n",
      " |  __rfloordiv__(self, other)\n",
      " |\n",
      " |  __rmod__(self, other)\n",
      " |\n",
      " |  __rmul__(self, other)\n",
      " |\n",
      " |  __round__ = round(self, n=None)\n",
      " |\n",
      " |  __rpow__(self, other)\n",
      " |\n",
      " |  __rsub__(self, other)\n",
      " |\n",
      " |  __rtruediv__(self, other)\n",
      " |\n",
      " |  __sub__(self, other)\n",
      " |\n",
      " |  __truediv__(self, other)\n",
      " |\n",
      " |  __trunc__(self)\n",
      " |\n",
      " |  adjoint(self)\n",
      " |\n",
      " |  apart(self, x=None, **args)\n",
      " |      See the apart function in sympy.polys\n",
      " |\n",
      " |  args_cnc(self, cset=False, warn=True, split_1=True)\n",
      " |      Return [commutative factors, non-commutative factors] of self.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      self is treated as a Mul and the ordering of the factors is maintained.\n",
      " |      If ``cset`` is True the commutative factors will be returned in a set.\n",
      " |      If there were repeated factors (as may happen with an unevaluated Mul)\n",
      " |      then an error will be raised unless it is explicitly suppressed by\n",
      " |      setting ``warn`` to False.\n",
      " |\n",
      " |      Note: -1 is always separated from a Number unless split_1 is False.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import symbols, oo\n",
      " |      >>> A, B = symbols('A B', commutative=0)\n",
      " |      >>> x, y = symbols('x y')\n",
      " |      >>> (-2*x*y).args_cnc()\n",
      " |      [[-1, 2, x, y], []]\n",
      " |      >>> (-2.5*x).args_cnc()\n",
      " |      [[-1, 2.5, x], []]\n",
      " |      >>> (-2*x*A*B*y).args_cnc()\n",
      " |      [[-1, 2, x, y], [A, B]]\n",
      " |      >>> (-2*x*A*B*y).args_cnc(split_1=False)\n",
      " |      [[-2, x, y], [A, B]]\n",
      " |      >>> (-2*x*y).args_cnc(cset=True)\n",
      " |      [{-1, 2, x, y}, []]\n",
      " |\n",
      " |      The arg is always treated as a Mul:\n",
      " |\n",
      " |      >>> (-2 + x + A).args_cnc()\n",
      " |      [[], [x - 2 + A]]\n",
      " |      >>> (-oo).args_cnc() # -oo is a singleton\n",
      " |      [[-1, oo], []]\n",
      " |\n",
      " |  as_coeff_Add(self, rational=False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a summation.\n",
      " |\n",
      " |  as_coeff_Mul(self, rational: 'bool' = False) -> \"tuple['Number', Expr]\"\n",
      " |      Efficiently extract the coefficient of a product.\n",
      " |\n",
      " |  as_coeff_add(self, *deps) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as an Add, ``a``.\n",
      " |\n",
      " |      c should be a Rational added to any terms of the Add that are\n",
      " |      independent of deps.\n",
      " |\n",
      " |      args should be a tuple of all other terms of ``a``; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |\n",
      " |      This should be used when you do not know if self is an Add or not but\n",
      " |      you want to treat self as an Add or if you want to process the\n",
      " |      individual arguments of the tail of self as an Add.\n",
      " |\n",
      " |      - if you know self is an Add and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail.\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |\n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_add()\n",
      " |      (3, ())\n",
      " |      >>> (3 + x).as_coeff_add()\n",
      " |      (3, (x,))\n",
      " |      >>> (3 + x + y).as_coeff_add(x)\n",
      " |      (y + 3, (x,))\n",
      " |      >>> (3 + y).as_coeff_add(x)\n",
      " |      (y + 3, ())\n",
      " |\n",
      " |  as_coeff_exponent(self, x) -> 'tuple[Expr, Expr]'\n",
      " |      ``c*x**e -> c,e`` where x can be any symbolic expression.\n",
      " |\n",
      " |  as_coeff_mul(self, *deps, **kwargs) -> 'tuple[Expr, tuple[Expr, ...]]'\n",
      " |      Return the tuple (c, args) where self is written as a Mul, ``m``.\n",
      " |\n",
      " |      c should be a Rational multiplied by any factors of the Mul that are\n",
      " |      independent of deps.\n",
      " |\n",
      " |      args should be a tuple of all other factors of m; args is empty\n",
      " |      if self is a Number or if self is independent of deps (when given).\n",
      " |\n",
      " |      This should be used when you do not know if self is a Mul or not but\n",
      " |      you want to treat self as a Mul or if you want to process the\n",
      " |      individual arguments of the tail of self as a Mul.\n",
      " |\n",
      " |      - if you know self is a Mul and want only the head, use self.args[0];\n",
      " |      - if you do not want to process the arguments of the tail but need the\n",
      " |        tail then use self.as_two_terms() which gives the head and tail;\n",
      " |      - if you want to split self into an independent and dependent parts\n",
      " |        use ``self.as_independent(*deps)``\n",
      " |\n",
      " |      >>> from sympy import S\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (S(3)).as_coeff_mul()\n",
      " |      (3, ())\n",
      " |      >>> (3*x*y).as_coeff_mul()\n",
      " |      (3, (x, y))\n",
      " |      >>> (3*x*y).as_coeff_mul(x)\n",
      " |      (3*y, (x,))\n",
      " |      >>> (3*y).as_coeff_mul(x)\n",
      " |      (3*y, ())\n",
      " |\n",
      " |  as_coefficient(self, expr)\n",
      " |      Extracts symbolic coefficient at the given expression. In\n",
      " |      other words, this functions separates 'self' into the product\n",
      " |      of 'expr' and 'expr'-free coefficient. If such separation\n",
      " |      is not possible it will return None.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import E, pi, sin, I, Poly\n",
      " |      >>> from sympy.abc import x\n",
      " |\n",
      " |      >>> E.as_coefficient(E)\n",
      " |      1\n",
      " |      >>> (2*E).as_coefficient(E)\n",
      " |      2\n",
      " |      >>> (2*sin(E)*E).as_coefficient(E)\n",
      " |\n",
      " |      Two terms have E in them so a sum is returned. (If one were\n",
      " |      desiring the coefficient of the term exactly matching E then\n",
      " |      the constant from the returned expression could be selected.\n",
      " |      Or, for greater precision, a method of Poly can be used to\n",
      " |      indicate the desired term from which the coefficient is\n",
      " |      desired.)\n",
      " |\n",
      " |      >>> (2*E + x*E).as_coefficient(E)\n",
      " |      x + 2\n",
      " |      >>> _.args[0]  # just want the exact match\n",
      " |      2\n",
      " |      >>> p = Poly(2*E + x*E); p\n",
      " |      Poly(x*E + 2*E, x, E, domain='ZZ')\n",
      " |      >>> p.coeff_monomial(E)\n",
      " |      2\n",
      " |      >>> p.nth(0, 1)\n",
      " |      2\n",
      " |\n",
      " |      Since the following cannot be written as a product containing\n",
      " |      E as a factor, None is returned. (If the coefficient ``2*x`` is\n",
      " |      desired then the ``coeff`` method should be used.)\n",
      " |\n",
      " |      >>> (2*E*x + x).as_coefficient(E)\n",
      " |      >>> (2*E*x + x).coeff(E)\n",
      " |      2*x\n",
      " |\n",
      " |      >>> (E*(x + 1) + x).as_coefficient(E)\n",
      " |\n",
      " |      >>> (2*pi*I).as_coefficient(pi*I)\n",
      " |      2\n",
      " |      >>> (2*I).as_coefficient(pi*I)\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      coeff: return sum of terms have a given factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |\n",
      " |  as_coefficients_dict(self, *syms)\n",
      " |      Return a dictionary mapping terms to their Rational coefficient.\n",
      " |      Since the dictionary is a defaultdict, inquiries about terms which\n",
      " |      were not present will return a coefficient of 0.\n",
      " |\n",
      " |      If symbols ``syms`` are provided, any multiplicative terms\n",
      " |      independent of them will be considered a coefficient and a\n",
      " |      regular dictionary of syms-dependent generators as keys and\n",
      " |      their corresponding coefficients as values will be returned.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import a, x, y\n",
      " |      >>> (3*x + a*x + 4).as_coefficients_dict()\n",
      " |      {1: 4, x: 3, a*x: 1}\n",
      " |      >>> _[a]\n",
      " |      0\n",
      " |      >>> (3*a*x).as_coefficients_dict()\n",
      " |      {a*x: 3}\n",
      " |      >>> (3*a*x).as_coefficients_dict(x)\n",
      " |      {x: 3*a}\n",
      " |      >>> (3*a*x).as_coefficients_dict(y)\n",
      " |      {1: 3*a*x}\n",
      " |\n",
      " |  as_content_primitive(self, radical=False, clear=True)\n",
      " |      This method should recursively remove a Rational from all arguments\n",
      " |      and return that (content) and the new self (primitive). The content\n",
      " |      should always be positive and ``Mul(*foo.as_content_primitive()) == foo``.\n",
      " |      The primitive need not be in canonical form and should try to preserve\n",
      " |      the underlying structure if possible (i.e. expand_mul should not be\n",
      " |      applied to self).\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |\n",
      " |      >>> eq = 2 + 2*x + 2*y*(3 + 3*y)\n",
      " |\n",
      " |      The as_content_primitive function is recursive and retains structure:\n",
      " |\n",
      " |      >>> eq.as_content_primitive()\n",
      " |      (2, x + 3*y*(y + 1) + 1)\n",
      " |\n",
      " |      Integer powers will have Rationals extracted from the base:\n",
      " |\n",
      " |      >>> ((2 + 6*x)**2).as_content_primitive()\n",
      " |      (4, (3*x + 1)**2)\n",
      " |      >>> ((2 + 6*x)**(2*y)).as_content_primitive()\n",
      " |      (1, (2*(3*x + 1))**(2*y))\n",
      " |\n",
      " |      Terms may end up joining once their as_content_primitives are added:\n",
      " |\n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (11, x*(y + 1))\n",
      " |      >>> ((3*(x*(1 + y)) + 2*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (9, x*(y + 1))\n",
      " |      >>> ((3*(z*(1 + y)) + 2.0*x*(3 + 3*y))).as_content_primitive()\n",
      " |      (1, 6.0*x*(y + 1) + 3*z*(y + 1))\n",
      " |      >>> ((5*(x*(1 + y)) + 2*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (121, x**2*(y + 1)**2)\n",
      " |      >>> ((x*(1 + y) + 0.4*x*(3 + 3*y))**2).as_content_primitive()\n",
      " |      (1, 4.84*x**2*(y + 1)**2)\n",
      " |\n",
      " |      Radical content can also be factored out of the primitive:\n",
      " |\n",
      " |      >>> (2*sqrt(2) + 4*sqrt(10)).as_content_primitive(radical=True)\n",
      " |      (2, sqrt(2)*(1 + 2*sqrt(5)))\n",
      " |\n",
      " |      If clear=False (default is True) then content will not be removed\n",
      " |      from an Add if it can be distributed to leave one or more\n",
      " |      terms with integer coefficients.\n",
      " |\n",
      " |      >>> (x/2 + y).as_content_primitive()\n",
      " |      (1/2, x + 2*y)\n",
      " |      >>> (x/2 + y).as_content_primitive(clear=False)\n",
      " |      (1, x/2 + y)\n",
      " |\n",
      " |  as_expr(self, *gens)\n",
      " |      Convert a polynomial to a SymPy expression.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |\n",
      " |      >>> f = (x**2 + x*y).as_poly(x, y)\n",
      " |      >>> f.as_expr()\n",
      " |      x**2 + x*y\n",
      " |\n",
      " |      >>> sin(x).as_expr()\n",
      " |      sin(x)\n",
      " |\n",
      " |  as_independent(self, *deps, **hint) -> 'tuple[Expr, Expr]'\n",
      " |      A mostly naive separation of a Mul or Add into arguments that are not\n",
      " |      are dependent on deps. To obtain as complete a separation of variables\n",
      " |      as possible, use a separation method first, e.g.:\n",
      " |\n",
      " |      * separatevars() to change Mul, Add and Pow (including exp) into Mul\n",
      " |      * .expand(mul=True) to change Add or Mul into Add\n",
      " |      * .expand(log=True) to change log expr into an Add\n",
      " |\n",
      " |      The only non-naive thing that is done here is to respect noncommutative\n",
      " |      ordering of variables and to always return (0, 0) for `self` of zero\n",
      " |      regardless of hints.\n",
      " |\n",
      " |      For nonzero `self`, the returned tuple (i, d) has the\n",
      " |      following interpretation:\n",
      " |\n",
      " |      * i will has no variable that appears in deps\n",
      " |      * d will either have terms that contain variables that are in deps, or\n",
      " |        be equal to 0 (when self is an Add) or 1 (when self is a Mul)\n",
      " |      * if self is an Add then self = i + d\n",
      " |      * if self is a Mul then self = i*d\n",
      " |      * otherwise (self, S.One) or (S.One, self) is returned.\n",
      " |\n",
      " |      To force the expression to be treated as an Add, use the hint as_Add=True\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      -- self is an Add\n",
      " |\n",
      " |      >>> from sympy import sin, cos, exp\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |\n",
      " |      >>> (x + x*y).as_independent(x)\n",
      " |      (0, x*y + x)\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x)\n",
      " |      (y + z, 2*x*sin(x) + x)\n",
      " |      >>> (2*x*sin(x) + y + x + z).as_independent(x, y)\n",
      " |      (z, 2*x*sin(x) + x + y)\n",
      " |\n",
      " |      -- self is a Mul\n",
      " |\n",
      " |      >>> (x*sin(x)*cos(y)).as_independent(x)\n",
      " |      (cos(y), x*sin(x))\n",
      " |\n",
      " |      non-commutative terms cannot always be separated out when self is a Mul\n",
      " |\n",
      " |      >>> from sympy import symbols\n",
      " |      >>> n1, n2, n3 = symbols('n1 n2 n3', commutative=False)\n",
      " |      >>> (n1 + n1*n2).as_independent(n2)\n",
      " |      (n1, n1*n2)\n",
      " |      >>> (n2*n1 + n1*n2).as_independent(n2)\n",
      " |      (0, n1*n2 + n2*n1)\n",
      " |      >>> (n1*n2*n3).as_independent(n1)\n",
      " |      (1, n1*n2*n3)\n",
      " |      >>> (n1*n2*n3).as_independent(n2)\n",
      " |      (n1, n2*n3)\n",
      " |      >>> ((x-n1)*(x-y)).as_independent(x)\n",
      " |      (1, (x - y)*(x - n1))\n",
      " |\n",
      " |      -- self is anything else:\n",
      " |\n",
      " |      >>> (sin(x)).as_independent(x)\n",
      " |      (1, sin(x))\n",
      " |      >>> (sin(x)).as_independent(y)\n",
      " |      (sin(x), 1)\n",
      " |      >>> exp(x+y).as_independent(x)\n",
      " |      (1, exp(x + y))\n",
      " |\n",
      " |      -- force self to be treated as an Add:\n",
      " |\n",
      " |      >>> (3*x).as_independent(x, as_Add=True)\n",
      " |      (0, 3*x)\n",
      " |\n",
      " |      -- force self to be treated as a Mul:\n",
      " |\n",
      " |      >>> (3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x + 3)\n",
      " |      >>> (-3+x).as_independent(x, as_Add=False)\n",
      " |      (1, x - 3)\n",
      " |\n",
      " |      Note how the below differs from the above in making the\n",
      " |      constant on the dep term positive.\n",
      " |\n",
      " |      >>> (y*(-3+x)).as_independent(x)\n",
      " |      (y, x - 3)\n",
      " |\n",
      " |      -- use .as_independent() for true independence testing instead\n",
      " |         of .has(). The former considers only symbols in the free\n",
      " |         symbols while the latter considers all symbols\n",
      " |\n",
      " |      >>> from sympy import Integral\n",
      " |      >>> I = Integral(x, (x, 1, 2))\n",
      " |      >>> I.has(x)\n",
      " |      True\n",
      " |      >>> x in I.free_symbols\n",
      " |      False\n",
      " |      >>> I.as_independent(x) == (I, 1)\n",
      " |      True\n",
      " |      >>> (I + x).as_independent(x) == (I, x)\n",
      " |      True\n",
      " |\n",
      " |      Note: when trying to get independent terms, a separation method\n",
      " |      might need to be used first. In this case, it is important to keep\n",
      " |      track of what you send to this routine so you know how to interpret\n",
      " |      the returned values\n",
      " |\n",
      " |      >>> from sympy import separatevars, log\n",
      " |      >>> separatevars(exp(x+y)).as_independent(x)\n",
      " |      (exp(y), exp(x))\n",
      " |      >>> (x + x*y).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> separatevars(x + x*y).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).as_independent(y)\n",
      " |      (x, y + 1)\n",
      " |      >>> (x*(1 + y)).expand(mul=True).as_independent(y)\n",
      " |      (x, x*y)\n",
      " |      >>> a, b=symbols('a b', positive=True)\n",
      " |      >>> (log(a*b).expand(log=True)).as_independent(b)\n",
      " |      (log(a), log(b))\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      separatevars\n",
      " |      expand_log\n",
      " |      sympy.core.add.Add.as_two_terms\n",
      " |      sympy.core.mul.Mul.as_two_terms\n",
      " |      as_coeff_mul\n",
      " |\n",
      " |  as_leading_term(self, *symbols, logx=None, cdir=0)\n",
      " |      Returns the leading (nonzero) term of the series expansion of self.\n",
      " |\n",
      " |      The _eval_as_leading_term routines are used to do this, and they must\n",
      " |      always return a non-zero value.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + x**2).as_leading_term(x)\n",
      " |      1\n",
      " |      >>> (1/x**2 + x + x**2).as_leading_term(x)\n",
      " |      x**(-2)\n",
      " |\n",
      " |  as_numer_denom(self)\n",
      " |      Return the numerator and the denominator of an expression.\n",
      " |\n",
      " |      expression -> a/b -> a, b\n",
      " |\n",
      " |      This is just a stub that should be defined by\n",
      " |      an object's class methods to get anything else.\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      normal: return ``a/b`` instead of ``(a, b)``\n",
      " |\n",
      " |  as_ordered_factors(self, order=None)\n",
      " |      Return list of ordered factors (if Mul) else [self].\n",
      " |\n",
      " |  as_ordered_terms(self, order=None, data=False)\n",
      " |      Transform an expression to an ordered list of terms.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sin, cos\n",
      " |      >>> from sympy.abc import x\n",
      " |\n",
      " |      >>> (sin(x)**2*cos(x) + sin(x)**2 + 1).as_ordered_terms()\n",
      " |      [sin(x)**2*cos(x), sin(x)**2, 1]\n",
      " |\n",
      " |  as_poly(self, *gens, **args)\n",
      " |      Converts ``self`` to a polynomial or returns ``None``.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |\n",
      " |      >>> print((x**2 + x*y).as_poly())\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |\n",
      " |      >>> print((x**2 + x*y).as_poly(x, y))\n",
      " |      Poly(x**2 + x*y, x, y, domain='ZZ')\n",
      " |\n",
      " |      >>> print((x**2 + sin(y)).as_poly(x, y))\n",
      " |      None\n",
      " |\n",
      " |  as_powers_dict(self)\n",
      " |      Return self as a dictionary of factors with each factor being\n",
      " |      treated as a power. The keys are the bases of the factors and the\n",
      " |      values, the corresponding exponents. The resulting dictionary should\n",
      " |      be used with caution if the expression is a Mul and contains non-\n",
      " |      commutative factors since the order that they appeared will be lost in\n",
      " |      the dictionary.\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |      as_ordered_factors: An alternative for noncommutative applications,\n",
      " |                          returning an ordered list of factors.\n",
      " |      args_cnc: Similar to as_ordered_factors, but guarantees separation\n",
      " |                of commutative and noncommutative factors.\n",
      " |\n",
      " |  as_terms(self)\n",
      " |      Transform an expression to a list of terms.\n",
      " |\n",
      " |  aseries(self, x=None, n=6, bound=0, hir=False)\n",
      " |      Asymptotic Series expansion of self.\n",
      " |      This is equivalent to ``self.series(x, oo, n)``.\n",
      " |\n",
      " |      Parameters\n",
      " |      ==========\n",
      " |\n",
      " |      self : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |\n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |\n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |\n",
      " |      hir : Boolean\n",
      " |            Set this parameter to be True to produce hierarchical series.\n",
      " |            It stops the recursion at an early level and may provide nicer\n",
      " |            and more useful results.\n",
      " |\n",
      " |      bound : Value, Integer\n",
      " |              Use the ``bound`` parameter to give limit on rewriting\n",
      " |              coefficients in its normalised form.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sin, exp\n",
      " |      >>> from sympy.abc import x\n",
      " |\n",
      " |      >>> e = sin(1/x + exp(-x)) - sin(1/x)\n",
      " |\n",
      " |      >>> e.aseries(x)\n",
      " |      (1/(24*x**4) - 1/(2*x**2) + 1 + O(x**(-6), (x, oo)))*exp(-x)\n",
      " |\n",
      " |      >>> e.aseries(x, n=3, hir=True)\n",
      " |      -exp(-2*x)*sin(1/x)/2 + exp(-x)*cos(1/x) + O(exp(-3*x), (x, oo))\n",
      " |\n",
      " |      >>> e = exp(exp(x)/(1 - 1/x))\n",
      " |\n",
      " |      >>> e.aseries(x)\n",
      " |      exp(exp(x)/(1 - 1/x))\n",
      " |\n",
      " |      >>> e.aseries(x, bound=3) # doctest: +SKIP\n",
      " |      exp(exp(x)/x**2)*exp(exp(x)/x)*exp(-exp(x) + exp(x)/(1 - 1/x) - exp(x)/x - exp(x)/x**2)*exp(exp(x))\n",
      " |\n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).aseries(x, n=8)\n",
      " |      1/x\n",
      " |\n",
      " |      Returns\n",
      " |      =======\n",
      " |\n",
      " |      Expr\n",
      " |          Asymptotic series expansion of the expression.\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      This algorithm is directly induced from the limit computational algorithm provided by Gruntz.\n",
      " |      It majorly uses the mrv and rewrite sub-routines. The overall idea of this algorithm is first\n",
      " |      to look for the most rapidly varying subexpression w of a given expression f and then expands f\n",
      " |      in a series in w. Then same thing is recursively done on the leading coefficient\n",
      " |      till we get constant coefficients.\n",
      " |\n",
      " |      If the most rapidly varying subexpression of a given expression f is f itself,\n",
      " |      the algorithm tries to find a normalised representation of the mrv set and rewrites f\n",
      " |      using this normalised representation.\n",
      " |\n",
      " |      If the expansion contains an order term, it will be either ``O(x ** (-n))`` or ``O(w ** (-n))``\n",
      " |      where ``w`` belongs to the most rapidly varying expression of ``self``.\n",
      " |\n",
      " |      References\n",
      " |      ==========\n",
      " |\n",
      " |      .. [1] Gruntz, Dominik. A new algorithm for computing asymptotic series.\n",
      " |             In: Proc. 1993 Int. Symp. Symbolic and Algebraic Computation. 1993.\n",
      " |             pp. 239-244.\n",
      " |      .. [2] Gruntz thesis - p90\n",
      " |      .. [3] https://en.wikipedia.org/wiki/Asymptotic_expansion\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      Expr.aseries: See the docstring of this function for complete details of this wrapper.\n",
      " |\n",
      " |  cancel(self, *gens, **args)\n",
      " |      See the cancel function in sympy.polys\n",
      " |\n",
      " |  coeff(self, x, n=1, right=False, _first=True)\n",
      " |      Returns the coefficient from the term(s) containing ``x**n``. If ``n``\n",
      " |      is zero then all terms independent of ``x`` will be returned.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      When ``x`` is noncommutative, the coefficient to the left (default) or\n",
      " |      right of ``x`` can be returned. The keyword 'right' is ignored when\n",
      " |      ``x`` is commutative.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import symbols\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |\n",
      " |      You can select terms that have an explicit negative in front of them:\n",
      " |\n",
      " |      >>> (-x + 2*y).coeff(-1)\n",
      " |      x\n",
      " |      >>> (x - 2*y).coeff(-1)\n",
      " |      2*y\n",
      " |\n",
      " |      You can select terms with no Rational coefficient:\n",
      " |\n",
      " |      >>> (x + 2*y).coeff(1)\n",
      " |      x\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(1)\n",
      " |      0\n",
      " |\n",
      " |      You can select terms independent of x by making n=0; in this case\n",
      " |      expr.as_independent(x)[0] is returned (and 0 will be returned instead\n",
      " |      of None):\n",
      " |\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x, 0)\n",
      " |      3\n",
      " |      >>> eq = ((x + 1)**3).expand() + 1\n",
      " |      >>> eq\n",
      " |      x**3 + 3*x**2 + 3*x + 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 2]\n",
      " |      >>> eq -= 2\n",
      " |      >>> [eq.coeff(x, i) for i in reversed(range(4))]\n",
      " |      [1, 3, 3, 0]\n",
      " |\n",
      " |      You can select terms that have a numerical term in front of them:\n",
      " |\n",
      " |      >>> (-x - 2*y).coeff(2)\n",
      " |      -y\n",
      " |      >>> from sympy import sqrt\n",
      " |      >>> (x + sqrt(2)*x).coeff(sqrt(2))\n",
      " |      x\n",
      " |\n",
      " |      The matching is exact:\n",
      " |\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x)\n",
      " |      2\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**2)\n",
      " |      4\n",
      " |      >>> (3 + 2*x + 4*x**2).coeff(x**3)\n",
      " |      0\n",
      " |      >>> (z*(x + y)**2).coeff((x + y)**2)\n",
      " |      z\n",
      " |      >>> (z*(x + y)**2).coeff(x + y)\n",
      " |      0\n",
      " |\n",
      " |      In addition, no factoring is done, so 1 + z*(1 + y) is not obtained\n",
      " |      from the following:\n",
      " |\n",
      " |      >>> (x + z*(x + x*y)).coeff(x)\n",
      " |      1\n",
      " |\n",
      " |      If such factoring is desired, factor_terms can be used first:\n",
      " |\n",
      " |      >>> from sympy import factor_terms\n",
      " |      >>> factor_terms(x + z*(x + x*y)).coeff(x)\n",
      " |      z*(y + 1) + 1\n",
      " |\n",
      " |      >>> n, m, o = symbols('n m o', commutative=False)\n",
      " |      >>> n.coeff(n)\n",
      " |      1\n",
      " |      >>> (3*n).coeff(n)\n",
      " |      3\n",
      " |      >>> (n*m + m*n*m).coeff(n) # = (1 + m)*n*m\n",
      " |      1 + m\n",
      " |      >>> (n*m + m*n*m).coeff(n, right=True) # = (1 + m)*n*m\n",
      " |      m\n",
      " |\n",
      " |      If there is more than one possible coefficient 0 is returned:\n",
      " |\n",
      " |      >>> (n*m + m*n).coeff(n)\n",
      " |      0\n",
      " |\n",
      " |      If there is only one possible coefficient, it is returned:\n",
      " |\n",
      " |      >>> (n*m + x*m*n).coeff(m*n)\n",
      " |      x\n",
      " |      >>> (n*m + x*m*n).coeff(m*n, right=1)\n",
      " |      1\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      as_coefficient: separate the expression into a coefficient and factor\n",
      " |      as_coeff_Add: separate the additive constant from an expression\n",
      " |      as_coeff_Mul: separate the multiplicative constant from an expression\n",
      " |      as_independent: separate x-dependent terms/factors from others\n",
      " |      sympy.polys.polytools.Poly.coeff_monomial: efficiently find the single coefficient of a monomial in Poly\n",
      " |      sympy.polys.polytools.Poly.nth: like coeff_monomial but powers of monomial terms are used\n",
      " |\n",
      " |  collect(self, syms, func=None, evaluate=True, exact=False, distribute_order_term=True)\n",
      " |      See the collect function in sympy.simplify\n",
      " |\n",
      " |  combsimp(self)\n",
      " |      See the combsimp function in sympy.simplify\n",
      " |\n",
      " |  compute_leading_term(self, x, logx=None)\n",
      " |      Deprecated function to compute the leading term of a series.\n",
      " |\n",
      " |      as_leading_term is only allowed for results of .series()\n",
      " |      This is a wrapper to compute a series first.\n",
      " |\n",
      " |  conjugate(self)\n",
      " |      Returns the complex conjugate of 'self'.\n",
      " |\n",
      " |  could_extract_minus_sign(self)\n",
      " |      Return True if self has -1 as a leading factor or has\n",
      " |      more literal negative signs than positive signs in a sum,\n",
      " |      otherwise False.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = x - y\n",
      " |      >>> {i.could_extract_minus_sign() for i in (e, -e)}\n",
      " |      {False, True}\n",
      " |\n",
      " |      Though the ``y - x`` is considered like ``-(x - y)``, since it\n",
      " |      is in a product without a leading factor of -1, the result is\n",
      " |      false below:\n",
      " |\n",
      " |      >>> (x*(y - x)).could_extract_minus_sign()\n",
      " |      False\n",
      " |\n",
      " |      To put something in canonical form wrt to sign, use `signsimp`:\n",
      " |\n",
      " |      >>> from sympy import signsimp\n",
      " |      >>> signsimp(x*(y - x))\n",
      " |      -x*(x - y)\n",
      " |      >>> _.could_extract_minus_sign()\n",
      " |      True\n",
      " |\n",
      " |  count_ops(self, visual=None)\n",
      " |      Wrapper for count_ops that returns the operation count.\n",
      " |\n",
      " |  diff(self, *symbols, **assumptions)\n",
      " |\n",
      " |  dir(self, x, cdir)\n",
      " |\n",
      " |  equals(self, other, failing_expression=False)\n",
      " |      Return True if self == other, False if it does not, or None. If\n",
      " |      failing_expression is True then the expression which did not simplify\n",
      " |      to a 0 will be returned instead of None.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      If ``self`` is a Number (or complex number) that is not zero, then\n",
      " |      the result is False.\n",
      " |\n",
      " |      If ``self`` is a number and has not evaluated to zero, evalf will be\n",
      " |      used to test whether the expression evaluates to zero. If it does so\n",
      " |      and the result has significance (i.e. the precision is either -1, for\n",
      " |      a Rational result, or is greater than 1) then the evalf value will be\n",
      " |      used to return True or False.\n",
      " |\n",
      " |  expand(self, deep=True, modulus=None, power_base=True, power_exp=True, mul=True, log=True, multinomial=True, basic=True, **hints)\n",
      " |      Expand an expression using hints.\n",
      " |\n",
      " |      See the docstring of the expand() function in sympy.core.function for\n",
      " |      more information.\n",
      " |\n",
      " |  extract_additively(self, c)\n",
      " |      Return self - c if it's possible to subtract c from self and\n",
      " |      make all matching coefficients move towards zero, else return None.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> e = 2*x + 3\n",
      " |      >>> e.extract_additively(x + 1)\n",
      " |      x + 2\n",
      " |      >>> e.extract_additively(3*x)\n",
      " |      >>> e.extract_additively(4)\n",
      " |      >>> (y*(x + 1)).extract_additively(x + 1)\n",
      " |      >>> ((x + 1)*(x + 2*y + 1) + 3).extract_additively(x + 1)\n",
      " |      (x + 1)*(x + 2*y) + 3\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |      extract_multiplicatively\n",
      " |      coeff\n",
      " |      as_coefficient\n",
      " |\n",
      " |  extract_branch_factor(self, allow_half=False)\n",
      " |      Try to write self as ``exp_polar(2*pi*I*n)*z`` in a nice way.\n",
      " |      Return (z, n).\n",
      " |\n",
      " |      >>> from sympy import exp_polar, I, pi\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> exp_polar(I*pi).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), 0)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor()\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(-pi*I).extract_branch_factor()\n",
      " |      (exp_polar(I*pi), -1)\n",
      " |      >>> exp_polar(3*pi*I + x).extract_branch_factor()\n",
      " |      (exp_polar(x + I*pi), 1)\n",
      " |      >>> (y*exp_polar(-5*pi*I)*exp_polar(3*pi*I + 2*pi*x)).extract_branch_factor()\n",
      " |      (y*exp_polar(2*pi*x), -1)\n",
      " |      >>> exp_polar(-I*pi/2).extract_branch_factor()\n",
      " |      (exp_polar(-I*pi/2), 0)\n",
      " |\n",
      " |      If allow_half is True, also extract exp_polar(I*pi):\n",
      " |\n",
      " |      >>> exp_polar(I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1/2)\n",
      " |      >>> exp_polar(2*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 1)\n",
      " |      >>> exp_polar(3*I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, 3/2)\n",
      " |      >>> exp_polar(-I*pi).extract_branch_factor(allow_half=True)\n",
      " |      (1, -1/2)\n",
      " |\n",
      " |  extract_multiplicatively(self, c)\n",
      " |      Return None if it's not possible to make self in the form\n",
      " |      c * something in a nice way, i.e. preserving the properties\n",
      " |      of arguments of self.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import symbols, Rational\n",
      " |\n",
      " |      >>> x, y = symbols('x,y', real=True)\n",
      " |\n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**2 * y)\n",
      " |      x*y**2\n",
      " |\n",
      " |      >>> ((x*y)**3).extract_multiplicatively(x**4 * y)\n",
      " |\n",
      " |      >>> (2*x).extract_multiplicatively(2)\n",
      " |      x\n",
      " |\n",
      " |      >>> (2*x).extract_multiplicatively(3)\n",
      " |\n",
      " |      >>> (Rational(1, 2)*x).extract_multiplicatively(3)\n",
      " |      x/6\n",
      " |\n",
      " |  factor(self, *gens, **args)\n",
      " |      See the factor() function in sympy.polys.polytools\n",
      " |\n",
      " |  fourier_series(self, limits=None)\n",
      " |      Compute fourier sine/cosine series of self.\n",
      " |\n",
      " |      See the docstring of the :func:`fourier_series` in sympy.series.fourier\n",
      " |      for more information.\n",
      " |\n",
      " |  fps(self, x=None, x0=0, dir=1, hyper=True, order=4, rational=True, full=False)\n",
      " |      Compute formal power power series of self.\n",
      " |\n",
      " |      See the docstring of the :func:`fps` function in sympy.series.formal for\n",
      " |      more information.\n",
      " |\n",
      " |  gammasimp(self)\n",
      " |      See the gammasimp function in sympy.simplify\n",
      " |\n",
      " |  getO(self)\n",
      " |      Returns the additive O(..) symbol if there is one, else None.\n",
      " |\n",
      " |  getn(self)\n",
      " |      Returns the order of the expression.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      The order is determined either from the O(...) term. If there\n",
      " |      is no O(...) term, it returns None.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import O\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1 + x + O(x**2)).getn()\n",
      " |      2\n",
      " |      >>> (1 + x).getn()\n",
      " |\n",
      " |  integrate(self, *args, **kwargs)\n",
      " |      See the integrate function in sympy.integrals\n",
      " |\n",
      " |  invert(self, g, *gens, **args)\n",
      " |      Return the multiplicative inverse of ``self`` mod ``g``\n",
      " |      where ``self`` (and ``g``) may be symbolic expressions).\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |      sympy.core.numbers.mod_inverse, sympy.polys.polytools.invert\n",
      " |\n",
      " |  is_algebraic_expr(self, *syms)\n",
      " |      This tests whether a given expression is algebraic or not, in the\n",
      " |      given symbols, syms. When syms is not given, all free symbols\n",
      " |      will be used. The rational function does not have to be in expanded\n",
      " |      or in any kind of canonical form.\n",
      " |\n",
      " |      This function returns False for expressions that are \"algebraic\n",
      " |      expressions\" with symbolic exponents. This is a simple extension to the\n",
      " |      is_rational_function, including rational exponentiation.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Symbol, sqrt\n",
      " |      >>> x = Symbol('x', real=True)\n",
      " |      >>> sqrt(1 + x).is_rational_function()\n",
      " |      False\n",
      " |      >>> sqrt(1 + x).is_algebraic_expr()\n",
      " |      True\n",
      " |\n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be an algebraic\n",
      " |      expression to become one.\n",
      " |\n",
      " |      >>> from sympy import exp, factor\n",
      " |      >>> a = sqrt(exp(x)**2 + 2*exp(x) + 1)/(exp(x) + 1)\n",
      " |      >>> a.is_algebraic_expr(x)\n",
      " |      False\n",
      " |      >>> factor(a).is_algebraic_expr()\n",
      " |      True\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      is_rational_function\n",
      " |\n",
      " |      References\n",
      " |      ==========\n",
      " |\n",
      " |      .. [1] https://en.wikipedia.org/wiki/Algebraic_expression\n",
      " |\n",
      " |  is_constant(self, *wrt, **flags)\n",
      " |      Return True if self is constant, False if not, or None if\n",
      " |      the constancy could not be determined conclusively.\n",
      " |\n",
      " |      Explanation\n",
      " |      ===========\n",
      " |\n",
      " |      If an expression has no free symbols then it is a constant. If\n",
      " |      there are free symbols it is possible that the expression is a\n",
      " |      constant, perhaps (but not necessarily) zero. To test such\n",
      " |      expressions, a few strategies are tried:\n",
      " |\n",
      " |      1) numerical evaluation at two random points. If two such evaluations\n",
      " |      give two different values and the values have a precision greater than\n",
      " |      1 then self is not constant. If the evaluations agree or could not be\n",
      " |      obtained with any precision, no decision is made. The numerical testing\n",
      " |      is done only if ``wrt`` is different than the free symbols.\n",
      " |\n",
      " |      2) differentiation with respect to variables in 'wrt' (or all free\n",
      " |      symbols if omitted) to see if the expression is constant or not. This\n",
      " |      will not always lead to an expression that is zero even though an\n",
      " |      expression is constant (see added test in test_expr.py). If\n",
      " |      all derivatives are zero then self is constant with respect to the\n",
      " |      given symbols.\n",
      " |\n",
      " |      3) finding out zeros of denominator expression with free_symbols.\n",
      " |      It will not be constant if there are zeros. It gives more negative\n",
      " |      answers for expression that are not constant.\n",
      " |\n",
      " |      If neither evaluation nor differentiation can prove the expression is\n",
      " |      constant, None is returned unless two numerical values happened to be\n",
      " |      the same and the flag ``failing_number`` is True -- in that case the\n",
      " |      numerical value will be returned.\n",
      " |\n",
      " |      If flag simplify=False is passed, self will not be simplified;\n",
      " |      the default is True since self should be simplified before testing.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import cos, sin, Sum, S, pi\n",
      " |      >>> from sympy.abc import a, n, x, y\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> S(2).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, 10)).is_constant()\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant()\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(y)\n",
      " |      True\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(n)\n",
      " |      False\n",
      " |      >>> Sum(x, (x, 1, n)).is_constant(x)\n",
      " |      True\n",
      " |      >>> eq = a*cos(x)**2 + a*sin(x)**2 - a\n",
      " |      >>> eq.is_constant()\n",
      " |      True\n",
      " |      >>> eq.subs({x: pi, a: 2}) == eq.subs({x: pi, a: 3}) == 0\n",
      " |      True\n",
      " |\n",
      " |      >>> (0**x).is_constant()\n",
      " |      False\n",
      " |      >>> x.is_constant()\n",
      " |      False\n",
      " |      >>> (x**x).is_constant()\n",
      " |      False\n",
      " |      >>> one = cos(x)**2 + sin(x)**2\n",
      " |      >>> one.is_constant()\n",
      " |      True\n",
      " |      >>> ((one - 1)**(x + 1)).is_constant() in (True, False) # could be 0 or 1\n",
      " |      True\n",
      " |\n",
      " |  is_meromorphic(self, x, a)\n",
      " |      This tests whether an expression is meromorphic as\n",
      " |      a function of the given symbol ``x`` at the point ``a``.\n",
      " |\n",
      " |      This method is intended as a quick test that will return\n",
      " |      None if no decision can be made without simplification or\n",
      " |      more detailed analysis.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import zoo, log, sin, sqrt\n",
      " |      >>> from sympy.abc import x\n",
      " |\n",
      " |      >>> f = 1/x**2 + 1 - 2*x**3\n",
      " |      >>> f.is_meromorphic(x, 0)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> f.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |\n",
      " |      >>> g = x**log(3)\n",
      " |      >>> g.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> g.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> g.is_meromorphic(x, zoo)\n",
      " |      False\n",
      " |\n",
      " |      >>> h = sin(1/x)*x**2\n",
      " |      >>> h.is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> h.is_meromorphic(x, 1)\n",
      " |      True\n",
      " |      >>> h.is_meromorphic(x, zoo)\n",
      " |      True\n",
      " |\n",
      " |      Multivalued functions are considered meromorphic when their\n",
      " |      branches are meromorphic. Thus most functions are meromorphic\n",
      " |      everywhere except at essential singularities and branch points.\n",
      " |      In particular, they will be meromorphic also on branch cuts\n",
      " |      except at their endpoints.\n",
      " |\n",
      " |      >>> log(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> log(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |      >>> sqrt(x).is_meromorphic(x, -1)\n",
      " |      True\n",
      " |      >>> sqrt(x).is_meromorphic(x, 0)\n",
      " |      False\n",
      " |\n",
      " |  is_polynomial(self, *syms)\n",
      " |      Return True if self is a polynomial in syms and False otherwise.\n",
      " |\n",
      " |      This checks if self is an exact polynomial in syms.  This function\n",
      " |      returns False for expressions that are \"polynomials\" with symbolic\n",
      " |      exponents.  Thus, you should be able to apply polynomial algorithms to\n",
      " |      expressions for which this returns True, and Poly(expr, \\*syms) should\n",
      " |      work if and only if expr.is_polynomial(\\*syms) returns True. The\n",
      " |      polynomial does not have to be in expanded form.  If no symbols are\n",
      " |      given, all free symbols in the expression will be used.\n",
      " |\n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', polynomial=True).\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Symbol, Function\n",
      " |      >>> x = Symbol('x')\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial(x)\n",
      " |      True\n",
      " |      >>> ((x**2 + 1)**4).is_polynomial()\n",
      " |      True\n",
      " |      >>> (2**x + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (2**x + 1).is_polynomial(2**x)\n",
      " |      True\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (f(x) + 1).is_polynomial(x)\n",
      " |      False\n",
      " |      >>> (f(x) + 1).is_polynomial(f(x))\n",
      " |      True\n",
      " |      >>> (1/f(x) + 1).is_polynomial(f(x))\n",
      " |      False\n",
      " |\n",
      " |      >>> n = Symbol('n', nonnegative=True, integer=True)\n",
      " |      >>> (x**n + 1).is_polynomial(x)\n",
      " |      False\n",
      " |\n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a polynomial to\n",
      " |      become one.\n",
      " |\n",
      " |      >>> from sympy import sqrt, factor, cancel\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)\n",
      " |      >>> a.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      y + 1\n",
      " |      >>> factor(a).is_polynomial(y)\n",
      " |      True\n",
      " |\n",
      " |      >>> b = (y**2 + 2*y + 1)/(y + 1)\n",
      " |      >>> b.is_polynomial(y)\n",
      " |      False\n",
      " |      >>> cancel(b)\n",
      " |      y + 1\n",
      " |      >>> cancel(b).is_polynomial(y)\n",
      " |      True\n",
      " |\n",
      " |      See also .is_rational_function()\n",
      " |\n",
      " |  is_rational_function(self, *syms)\n",
      " |      Test whether function is a ratio of two polynomials in the given\n",
      " |      symbols, syms. When syms is not given, all free symbols will be used.\n",
      " |      The rational function does not have to be in expanded or in any kind of\n",
      " |      canonical form.\n",
      " |\n",
      " |      This function returns False for expressions that are \"rational\n",
      " |      functions\" with symbolic exponents.  Thus, you should be able to call\n",
      " |      .as_numer_denom() and apply polynomial algorithms to the result for\n",
      " |      expressions for which this returns True.\n",
      " |\n",
      " |      This is not part of the assumptions system.  You cannot do\n",
      " |      Symbol('z', rational_function=True).\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Symbol, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |\n",
      " |      >>> (x/y).is_rational_function()\n",
      " |      True\n",
      " |\n",
      " |      >>> (x**2).is_rational_function()\n",
      " |      True\n",
      " |\n",
      " |      >>> (x/sin(y)).is_rational_function(y)\n",
      " |      False\n",
      " |\n",
      " |      >>> n = Symbol('n', integer=True)\n",
      " |      >>> (x**n + 1).is_rational_function(x)\n",
      " |      False\n",
      " |\n",
      " |      This function does not attempt any nontrivial simplifications that may\n",
      " |      result in an expression that does not appear to be a rational function\n",
      " |      to become one.\n",
      " |\n",
      " |      >>> from sympy import sqrt, factor\n",
      " |      >>> y = Symbol('y', positive=True)\n",
      " |      >>> a = sqrt(y**2 + 2*y + 1)/y\n",
      " |      >>> a.is_rational_function(y)\n",
      " |      False\n",
      " |      >>> factor(a)\n",
      " |      (y + 1)/y\n",
      " |      >>> factor(a).is_rational_function(y)\n",
      " |      True\n",
      " |\n",
      " |      See also is_algebraic_expr().\n",
      " |\n",
      " |  leadterm(self, x, logx=None, cdir=0)\n",
      " |      Returns the leading term a*x**b as a tuple (a, b).\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (1+x+x**2).leadterm(x)\n",
      " |      (1, 0)\n",
      " |      >>> (1/x**2+x+x**2).leadterm(x)\n",
      " |      (1, -2)\n",
      " |\n",
      " |  limit(self, x, xlim, dir='+')\n",
      " |      Compute limit x->xlim.\n",
      " |\n",
      " |  lseries(self, x=None, x0=0, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper for series yielding an iterator of the terms of the series.\n",
      " |\n",
      " |      Note: an infinite series will yield an infinite iterator. The following,\n",
      " |      for exaxmple, will never terminate. It will just keep printing terms\n",
      " |      of the sin(x) series::\n",
      " |\n",
      " |        for term in sin(x).lseries(x):\n",
      " |            print term\n",
      " |\n",
      " |      The advantage of lseries() over nseries() is that many times you are\n",
      " |      just interested in the next term in the series (i.e. the first term for\n",
      " |      example), but you do not know how many you should ask for in nseries()\n",
      " |      using the \"n\" parameter.\n",
      " |\n",
      " |      See also nseries().\n",
      " |\n",
      " |  normal(self)\n",
      " |      Return the expression as a fraction.\n",
      " |\n",
      " |      expression -> a/b\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      as_numer_denom: return ``(a, b)`` instead of ``a/b``\n",
      " |\n",
      " |  nseries(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Wrapper to _eval_nseries if assumptions allow, else to series.\n",
      " |\n",
      " |      If x is given, x0 is 0, dir='+', and self has x, then _eval_nseries is\n",
      " |      called. This calculates \"n\" terms in the innermost expressions and\n",
      " |      then builds up the final series just by \"cross-multiplying\" everything\n",
      " |      out.\n",
      " |\n",
      " |      The optional ``logx`` parameter can be used to replace any log(x) in the\n",
      " |      returned series with a symbolic value to avoid evaluating log(x) at 0. A\n",
      " |      symbol to use in place of log(x) should be provided.\n",
      " |\n",
      " |      Advantage -- it's fast, because we do not have to determine how many\n",
      " |      terms we need to calculate in advance.\n",
      " |\n",
      " |      Disadvantage -- you may end up with less terms than you may have\n",
      " |      expected, but the O(x**n) term appended will always be correct and\n",
      " |      so the result, though perhaps shorter, will also be correct.\n",
      " |\n",
      " |      If any of those assumptions is not met, this is treated like a\n",
      " |      wrapper to series which will try harder to return the correct\n",
      " |      number of terms.\n",
      " |\n",
      " |      See also lseries().\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sin, log, Symbol\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> sin(x).nseries(x, 0, 6)\n",
      " |      x - x**3/6 + x**5/120 + O(x**6)\n",
      " |      >>> log(x+1).nseries(x, 0, 5)\n",
      " |      x - x**2/2 + x**3/3 - x**4/4 + O(x**5)\n",
      " |\n",
      " |      Handling of the ``logx`` parameter --- in the following example the\n",
      " |      expansion fails since ``sin`` does not have an asymptotic expansion\n",
      " |      at -oo (the limit of log(x) as x approaches 0):\n",
      " |\n",
      " |      >>> e = sin(log(x))\n",
      " |      >>> e.nseries(x, 0, 6)\n",
      " |      Traceback (most recent call last):\n",
      " |      ...\n",
      " |      PoleError: ...\n",
      " |      ...\n",
      " |      >>> logx = Symbol('logx')\n",
      " |      >>> e.nseries(x, 0, 6, logx=logx)\n",
      " |      sin(logx)\n",
      " |\n",
      " |      In the following example, the expansion works but only returns self\n",
      " |      unless the ``logx`` parameter is used:\n",
      " |\n",
      " |      >>> e = x**y\n",
      " |      >>> e.nseries(x, 0, 2)\n",
      " |      x**y\n",
      " |      >>> e.nseries(x, 0, 2, logx=logx)\n",
      " |      exp(logx*y)\n",
      " |\n",
      " |  nsimplify(self, constants=(), tolerance=None, full=False)\n",
      " |      See the nsimplify function in sympy.simplify\n",
      " |\n",
      " |  powsimp(self, *args, **kwargs)\n",
      " |      See the powsimp function in sympy.simplify\n",
      " |\n",
      " |  primitive(self)\n",
      " |      Return the positive Rational that can be extracted non-recursively\n",
      " |      from every term of self (i.e., self is treated like an Add). This is\n",
      " |      like the as_coeff_Mul() method but primitive always extracts a positive\n",
      " |      Rational (never a negative or a Float).\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> (3*(x + 1)**2).primitive()\n",
      " |      (3, (x + 1)**2)\n",
      " |      >>> a = (6*x + 2); a.primitive()\n",
      " |      (2, 3*x + 1)\n",
      " |      >>> b = (x/2 + 3); b.primitive()\n",
      " |      (1/2, x + 6)\n",
      " |      >>> (a*b).primitive() == (1, a*b)\n",
      " |      True\n",
      " |\n",
      " |  radsimp(self, **kwargs)\n",
      " |      See the radsimp function in sympy.simplify\n",
      " |\n",
      " |  ratsimp(self)\n",
      " |      See the ratsimp function in sympy.simplify\n",
      " |\n",
      " |  removeO(self)\n",
      " |      Removes the additive O(..) symbol if there is one\n",
      " |\n",
      " |  round(self, n=None)\n",
      " |      Return x rounded to the given decimal place.\n",
      " |\n",
      " |      If a complex number would results, apply round to the real\n",
      " |      and imaginary components of the number.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import pi, E, I, S, Number\n",
      " |      >>> pi.round()\n",
      " |      3\n",
      " |      >>> pi.round(2)\n",
      " |      3.14\n",
      " |      >>> (2*pi + E*I).round()\n",
      " |      6 + 3*I\n",
      " |\n",
      " |      The round method has a chopping effect:\n",
      " |\n",
      " |      >>> (2*pi + I/10).round()\n",
      " |      6\n",
      " |      >>> (pi/10 + 2*I).round()\n",
      " |      2*I\n",
      " |      >>> (pi/10 + E*I).round(2)\n",
      " |      0.31 + 2.72*I\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      The Python ``round`` function uses the SymPy ``round`` method so it\n",
      " |      will always return a SymPy number (not a Python float or int):\n",
      " |\n",
      " |      >>> isinstance(round(S(123), -2), Number)\n",
      " |      True\n",
      " |\n",
      " |  separate(self, deep=False, force=False)\n",
      " |      See the separate function in sympy.simplify\n",
      " |\n",
      " |  series(self, x=None, x0=0, n=6, dir='+', logx=None, cdir=0)\n",
      " |      Series expansion of \"self\" around ``x = x0`` yielding either terms of\n",
      " |      the series one by one (the lazy series given when n=None), else\n",
      " |      all the terms at once when n != None.\n",
      " |\n",
      " |      Returns the series expansion of \"self\" around the point ``x = x0``\n",
      " |      with respect to ``x`` up to ``O((x - x0)**n, x, x0)`` (default n is 6).\n",
      " |\n",
      " |      If ``x=None`` and ``self`` is univariate, the univariate symbol will\n",
      " |      be supplied, otherwise an error will be raised.\n",
      " |\n",
      " |      Parameters\n",
      " |      ==========\n",
      " |\n",
      " |      expr : Expression\n",
      " |             The expression whose series is to be expanded.\n",
      " |\n",
      " |      x : Symbol\n",
      " |          It is the variable of the expression to be calculated.\n",
      " |\n",
      " |      x0 : Value\n",
      " |           The value around which ``x`` is calculated. Can be any value\n",
      " |           from ``-oo`` to ``oo``.\n",
      " |\n",
      " |      n : Value\n",
      " |          The value used to represent the order in terms of ``x**n``,\n",
      " |          up to which the series is to be expanded.\n",
      " |\n",
      " |      dir : String, optional\n",
      " |            The series-expansion can be bi-directional. If ``dir=\"+\"``,\n",
      " |            then (x->x0+). If ``dir=\"-\", then (x->x0-). For infinite\n",
      " |            ``x0`` (``oo`` or ``-oo``), the ``dir`` argument is determined\n",
      " |            from the direction of the infinity (i.e., ``dir=\"-\"`` for\n",
      " |            ``oo``).\n",
      " |\n",
      " |      logx : optional\n",
      " |             It is used to replace any log(x) in the returned series with a\n",
      " |             symbolic value rather than evaluating the actual value.\n",
      " |\n",
      " |      cdir : optional\n",
      " |             It stands for complex direction, and indicates the direction\n",
      " |             from which the expansion needs to be evaluated.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import cos, exp, tan\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> cos(x).series()\n",
      " |      1 - x**2/2 + x**4/24 + O(x**6)\n",
      " |      >>> cos(x).series(n=4)\n",
      " |      1 - x**2/2 + O(x**4)\n",
      " |      >>> cos(x).series(x, x0=1, n=2)\n",
      " |      cos(1) - (x - 1)*sin(1) + O((x - 1)**2, (x, 1))\n",
      " |      >>> e = cos(x + exp(y))\n",
      " |      >>> e.series(y, n=2)\n",
      " |      cos(x + 1) - y*sin(x + 1) + O(y**2)\n",
      " |      >>> e.series(x, n=2)\n",
      " |      cos(exp(y)) - x*sin(exp(y)) + O(x**2)\n",
      " |\n",
      " |      If ``n=None`` then a generator of the series terms will be returned.\n",
      " |\n",
      " |      >>> term=cos(x).series(n=None)\n",
      " |      >>> [next(term) for i in range(2)]\n",
      " |      [1, -x**2/2]\n",
      " |\n",
      " |      For ``dir=+`` (default) the series is calculated from the right and\n",
      " |      for ``dir=-`` the series from the left. For smooth functions this\n",
      " |      flag will not alter the results.\n",
      " |\n",
      " |      >>> abs(x).series(dir=\"+\")\n",
      " |      x\n",
      " |      >>> abs(x).series(dir=\"-\")\n",
      " |      -x\n",
      " |      >>> f = tan(x)\n",
      " |      >>> f.series(x, 2, 6, \"+\")\n",
      " |      tan(2) + (1 + tan(2)**2)*(x - 2) + (x - 2)**2*(tan(2)**3 + tan(2)) +\n",
      " |      (x - 2)**3*(1/3 + 4*tan(2)**2/3 + tan(2)**4) + (x - 2)**4*(tan(2)**5 +\n",
      " |      5*tan(2)**3/3 + 2*tan(2)/3) + (x - 2)**5*(2/15 + 17*tan(2)**2/15 +\n",
      " |      2*tan(2)**4 + tan(2)**6) + O((x - 2)**6, (x, 2))\n",
      " |\n",
      " |      >>> f.series(x, 2, 3, \"-\")\n",
      " |      tan(2) + (2 - x)*(-tan(2)**2 - 1) + (2 - x)**2*(tan(2)**3 + tan(2))\n",
      " |      + O((x - 2)**3, (x, 2))\n",
      " |\n",
      " |      For rational expressions this method may return original expression without the Order term.\n",
      " |      >>> (1/x).series(x, n=8)\n",
      " |      1/x\n",
      " |\n",
      " |      Returns\n",
      " |      =======\n",
      " |\n",
      " |      Expr : Expression\n",
      " |          Series expansion of the expression about x0\n",
      " |\n",
      " |      Raises\n",
      " |      ======\n",
      " |\n",
      " |      TypeError\n",
      " |          If \"n\" and \"x0\" are infinity objects\n",
      " |\n",
      " |      PoleError\n",
      " |          If \"x0\" is an infinity object\n",
      " |\n",
      " |  sort_key(self, order=None)\n",
      " |      Return a sort key.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import S, I\n",
      " |\n",
      " |      >>> sorted([S(1)/2, I, -I], key=lambda x: x.sort_key())\n",
      " |      [1/2, -I, I]\n",
      " |\n",
      " |      >>> S(\"[x, 1/x, 1/x**2, x**2, x**(1/2), x**(1/4), x**(3/2)]\")\n",
      " |      [x, 1/x, x**(-2), x**2, sqrt(x), x**(1/4), x**(3/2)]\n",
      " |      >>> sorted(_, key=lambda x: x.sort_key())\n",
      " |      [x**(-2), 1/x, x**(1/4), sqrt(x), x, x**(3/2), x**2]\n",
      " |\n",
      " |  together(self, *args, **kwargs)\n",
      " |      See the together function in sympy.polys\n",
      " |\n",
      " |  transpose(self)\n",
      " |\n",
      " |  trigsimp(self, **args)\n",
      " |      See the trigsimp function in sympy.simplify\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.expr.Expr:\n",
      " |\n",
      " |  expr_free_symbols\n",
      " |      Like ``free_symbols``, but returns the free symbols only if\n",
      " |      they are contained in an expression node.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (x + y).expr_free_symbols # doctest: +SKIP\n",
      " |      {x, y}\n",
      " |\n",
      " |      If the expression is contained in a non-expression object, do not return\n",
      " |      the free symbols. Compare:\n",
      " |\n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> t = Tuple(x + y)\n",
      " |      >>> t.expr_free_symbols # doctest: +SKIP\n",
      " |      set()\n",
      " |      >>> t.free_symbols\n",
      " |      {x, y}\n",
      " |\n",
      " |  is_number\n",
      " |      Returns True if ``self`` has no free symbols and no\n",
      " |      undefined functions (AppliedUndef, to be precise). It will be\n",
      " |      faster than ``if not self.free_symbols``, however, since\n",
      " |      ``is_number`` will fail as soon as it hits a free symbol\n",
      " |      or undefined function.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Function, Integral, cos, sin, pi\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> f = Function('f')\n",
      " |\n",
      " |      >>> x.is_number\n",
      " |      False\n",
      " |      >>> f(1).is_number\n",
      " |      False\n",
      " |      >>> (2*x).is_number\n",
      " |      False\n",
      " |      >>> (2 + Integral(2, x)).is_number\n",
      " |      False\n",
      " |      >>> (2 + Integral(2, (x, 1, 2))).is_number\n",
      " |      True\n",
      " |\n",
      " |      Not all numbers are Numbers in the SymPy sense:\n",
      " |\n",
      " |      >>> pi.is_number, pi.is_Number\n",
      " |      (True, False)\n",
      " |\n",
      " |      If something is a number it should evaluate to a number with\n",
      " |      real and imaginary parts that are Numbers; the result may not\n",
      " |      be comparable, however, since the real and/or imaginary part\n",
      " |      of the result may not have precision.\n",
      " |\n",
      " |      >>> cos(1).is_number and cos(1).is_comparable\n",
      " |      True\n",
      " |\n",
      " |      >>> z = cos(1)**2 + sin(1)**2 - 1\n",
      " |      >>> z.is_number\n",
      " |      True\n",
      " |      >>> z.is_comparable\n",
      " |      False\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      sympy.core.basic.Basic.is_comparable\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.expr.Expr:\n",
      " |\n",
      " |  is_scalar = True\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.basic.Basic:\n",
      " |\n",
      " |  __eq__(self, other)\n",
      " |      Return a boolean indicating whether a == b on the basis of\n",
      " |      their symbolic trees.\n",
      " |\n",
      " |      This is the same as a.compare(b) == 0 but faster.\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      If a class that overrides __eq__() needs to retain the\n",
      " |      implementation of __hash__() from a parent class, the\n",
      " |      interpreter must be told this explicitly by setting\n",
      " |      __hash__ : Callable[[object], int] = <ParentClass>.__hash__.\n",
      " |      Otherwise the inheritance of __hash__() will be blocked,\n",
      " |      just as if __hash__ had been explicitly set to None.\n",
      " |\n",
      " |      References\n",
      " |      ==========\n",
      " |\n",
      " |      from https://docs.python.org/dev/reference/datamodel.html#object.__hash__\n",
      " |\n",
      " |  __getnewargs__(self)\n",
      " |\n",
      " |  __getstate__(self)\n",
      " |      Helper for pickle.\n",
      " |\n",
      " |  __hash__(self) -> 'int'\n",
      " |      Return hash(self).\n",
      " |\n",
      " |  __ne__(self, other)\n",
      " |      ``a != b``  -> Compare two symbolic trees and see whether they are different\n",
      " |\n",
      " |      this is the same as:\n",
      " |\n",
      " |      ``a.compare(b) != 0``\n",
      " |\n",
      " |      but faster\n",
      " |\n",
      " |  __reduce_ex__(self, protocol)\n",
      " |      Helper for pickle.\n",
      " |\n",
      " |  __setstate__(self, state)\n",
      " |\n",
      " |  as_dummy(self)\n",
      " |      Return the expression with any objects having structurally\n",
      " |      bound symbols replaced with unique, canonical symbols within\n",
      " |      the object in which they appear and having only the default\n",
      " |      assumption for commutativity being True. When applied to a\n",
      " |      symbol a new symbol having only the same commutativity will be\n",
      " |      returned.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Integral, Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> r = Symbol('r', real=True)\n",
      " |      >>> Integral(r, (r, x)).as_dummy()\n",
      " |      Integral(_0, (_0, x))\n",
      " |      >>> _.variables[0].is_real is None\n",
      " |      True\n",
      " |      >>> r.as_dummy()\n",
      " |      _r\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      Any object that has structurally bound variables should have\n",
      " |      a property, `bound_symbols` that returns those symbols\n",
      " |      appearing in the object.\n",
      " |\n",
      " |  atoms(self, *types)\n",
      " |      Returns the atoms that form the current object.\n",
      " |\n",
      " |      By default, only objects that are truly atomic and cannot\n",
      " |      be divided into smaller pieces are returned: symbols, numbers,\n",
      " |      and number symbols like I and pi. It is possible to request\n",
      " |      atoms of any type, however, as demonstrated below.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import I, pi, sin\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms()\n",
      " |      {1, 2, I, pi, x, y}\n",
      " |\n",
      " |      If one or more types are given, the results will contain only\n",
      " |      those types of atoms.\n",
      " |\n",
      " |      >>> from sympy import Number, NumberSymbol, Symbol\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Symbol)\n",
      " |      {x, y}\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number)\n",
      " |      {1, 2}\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol)\n",
      " |      {1, 2, pi}\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Number, NumberSymbol, I)\n",
      " |      {1, 2, I, pi}\n",
      " |\n",
      " |      Note that I (imaginary unit) and zoo (complex infinity) are special\n",
      " |      types of number symbols and are not part of the NumberSymbol class.\n",
      " |\n",
      " |      The type can be given implicitly, too:\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(x) # x is a Symbol\n",
      " |      {x, y}\n",
      " |\n",
      " |      Be careful to check your assumptions when using the implicit option\n",
      " |      since ``S(1).is_Integer = True`` but ``type(S(1))`` is ``One``, a special type\n",
      " |      of SymPy atom, while ``type(S(2))`` is type ``Integer`` and will find all\n",
      " |      integers in an expression:\n",
      " |\n",
      " |      >>> from sympy import S\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(1))\n",
      " |      {1}\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(S(2))\n",
      " |      {1, 2}\n",
      " |\n",
      " |      Finally, arguments to atoms() can select more than atomic atoms: any\n",
      " |      SymPy type (loaded in core/__init__.py) can be listed as an argument\n",
      " |      and those types of \"atoms\" as found in scanning the arguments of the\n",
      " |      expression recursively:\n",
      " |\n",
      " |      >>> from sympy import Function, Mul\n",
      " |      >>> from sympy.core.function import AppliedUndef\n",
      " |      >>> f = Function('f')\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(Function)\n",
      " |      {f(x), sin(y + I*pi)}\n",
      " |      >>> (1 + f(x) + 2*sin(y + I*pi)).atoms(AppliedUndef)\n",
      " |      {f(x)}\n",
      " |\n",
      " |      >>> (1 + x + 2*sin(y + I*pi)).atoms(Mul)\n",
      " |      {I*pi, 2*sin(y + I*pi)}\n",
      " |\n",
      " |  compare(self, other)\n",
      " |      Return -1, 0, 1 if the object is smaller, equal, or greater than other.\n",
      " |\n",
      " |      Not in the mathematical sense. If the object is of a different type\n",
      " |      from the \"other\" then their classes are ordered according to\n",
      " |      the sorted_classes list.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> x.compare(y)\n",
      " |      -1\n",
      " |      >>> x.compare(x)\n",
      " |      0\n",
      " |      >>> y.compare(x)\n",
      " |      1\n",
      " |\n",
      " |  copy(self)\n",
      " |\n",
      " |  count(self, query)\n",
      " |      Count the number of matching subexpressions.\n",
      " |\n",
      " |  doit(self, **hints)\n",
      " |      Evaluate objects that are not evaluated by default like limits,\n",
      " |      integrals, sums and products. All objects of this kind will be\n",
      " |      evaluated recursively, unless some species were excluded via 'hints'\n",
      " |      or unless the 'deep' hint was set to 'False'.\n",
      " |\n",
      " |      >>> from sympy import Integral\n",
      " |      >>> from sympy.abc import x\n",
      " |\n",
      " |      >>> 2*Integral(x, x)\n",
      " |      2*Integral(x, x)\n",
      " |\n",
      " |      >>> (2*Integral(x, x)).doit()\n",
      " |      x**2\n",
      " |\n",
      " |      >>> (2*Integral(x, x)).doit(deep=False)\n",
      " |      2*Integral(x, x)\n",
      " |\n",
      " |  dummy_eq(self, other, symbol=None)\n",
      " |      Compare two expressions and handle dummy symbols.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Dummy\n",
      " |      >>> from sympy.abc import x, y\n",
      " |\n",
      " |      >>> u = Dummy('u')\n",
      " |\n",
      " |      >>> (u**2 + 1).dummy_eq(x**2 + 1)\n",
      " |      True\n",
      " |      >>> (u**2 + 1) == (x**2 + 1)\n",
      " |      False\n",
      " |\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, x)\n",
      " |      True\n",
      " |      >>> (u**2 + y).dummy_eq(x**2 + y, y)\n",
      " |      False\n",
      " |\n",
      " |  find(self, query, group=False)\n",
      " |      Find all subexpressions matching a query.\n",
      " |\n",
      " |  has(self, *patterns)\n",
      " |      Test whether any subexpression matches any of the patterns.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import sin\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x**2 + sin(x*y)).has(z)\n",
      " |      False\n",
      " |      >>> (x**2 + sin(x*y)).has(x, y, z)\n",
      " |      True\n",
      " |      >>> x.has(x)\n",
      " |      True\n",
      " |\n",
      " |      Note ``has`` is a structural algorithm with no knowledge of\n",
      " |      mathematics. Consider the following half-open interval:\n",
      " |\n",
      " |      >>> from sympy import Interval\n",
      " |      >>> i = Interval.Lopen(0, 5); i\n",
      " |      Interval.Lopen(0, 5)\n",
      " |      >>> i.args\n",
      " |      (0, 5, True, False)\n",
      " |      >>> i.has(4)  # there is no \"4\" in the arguments\n",
      " |      False\n",
      " |      >>> i.has(0)  # there *is* a \"0\" in the arguments\n",
      " |      True\n",
      " |\n",
      " |      Instead, use ``contains`` to determine whether a number is in the\n",
      " |      interval or not:\n",
      " |\n",
      " |      >>> i.contains(4)\n",
      " |      True\n",
      " |      >>> i.contains(0)\n",
      " |      False\n",
      " |\n",
      " |\n",
      " |      Note that ``expr.has(*patterns)`` is exactly equivalent to\n",
      " |      ``any(expr.has(p) for p in patterns)``. In particular, ``False`` is\n",
      " |      returned when the list of patterns is empty.\n",
      " |\n",
      " |      >>> x.has()\n",
      " |      False\n",
      " |\n",
      " |  has_free(self, *patterns)\n",
      " |      Return True if self has object(s) ``x`` as a free expression\n",
      " |      else False.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Integral, Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> g = Function('g')\n",
      " |      >>> expr = Integral(f(x), (f(x), 1, g(y)))\n",
      " |      >>> expr.free_symbols\n",
      " |      {y}\n",
      " |      >>> expr.has_free(g(y))\n",
      " |      True\n",
      " |      >>> expr.has_free(*(x, f(x)))\n",
      " |      False\n",
      " |\n",
      " |      This works for subexpressions and types, too:\n",
      " |\n",
      " |      >>> expr.has_free(g)\n",
      " |      True\n",
      " |      >>> (x + y + 1).has_free(y + 1)\n",
      " |      True\n",
      " |\n",
      " |  has_xfree(self, s: 'set[Basic]')\n",
      " |      Return True if self has any of the patterns in s as a\n",
      " |      free argument, else False. This is like `Basic.has_free`\n",
      " |      but this will only report exact argument matches.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Function\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = Function('f')\n",
      " |      >>> f(x).has_xfree({f})\n",
      " |      False\n",
      " |      >>> f(x).has_xfree({f(x)})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x})\n",
      " |      True\n",
      " |      >>> f(x + 1).has_xfree({x + 1})\n",
      " |      True\n",
      " |      >>> f(x + y + 1).has_xfree({x + 1})\n",
      " |      False\n",
      " |\n",
      " |  is_hypergeometric(self, k)\n",
      " |\n",
      " |  match(self, pattern, old=False)\n",
      " |      Pattern matching.\n",
      " |\n",
      " |      Wild symbols match all.\n",
      " |\n",
      " |      Return ``None`` when expression (self) does not match\n",
      " |      with pattern. Otherwise return a dictionary such that::\n",
      " |\n",
      " |        pattern.xreplace(self.match(pattern)) == self\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Wild, Sum\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> p = Wild(\"p\")\n",
      " |      >>> q = Wild(\"q\")\n",
      " |      >>> r = Wild(\"r\")\n",
      " |      >>> e = (x+y)**(x+y)\n",
      " |      >>> e.match(p**p)\n",
      " |      {p_: x + y}\n",
      " |      >>> e.match(p**q)\n",
      " |      {p_: x + y, q_: x + y}\n",
      " |      >>> e = (2*x)**2\n",
      " |      >>> e.match(p*q**r)\n",
      " |      {p_: 4, q_: x, r_: 2}\n",
      " |      >>> (p*q**r).xreplace(e.match(p*q**r))\n",
      " |      4*x**2\n",
      " |\n",
      " |      Structurally bound symbols are ignored during matching:\n",
      " |\n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(y, (y, 1, p)))\n",
      " |      {p_: 2}\n",
      " |\n",
      " |      But they can be identified if desired:\n",
      " |\n",
      " |      >>> Sum(x, (x, 1, 2)).match(Sum(q, (q, 1, p)))\n",
      " |      {p_: 2, q_: x}\n",
      " |\n",
      " |      The ``old`` flag will give the old-style pattern matching where\n",
      " |      expressions and patterns are essentially solved to give the\n",
      " |      match. Both of the following give None unless ``old=True``:\n",
      " |\n",
      " |      >>> (x - 2).match(p - x, old=True)\n",
      " |      {p_: 2*x - 2}\n",
      " |      >>> (2/x).match(p*x, old=True)\n",
      " |      {p_: 2/x**2}\n",
      " |\n",
      " |  matches(self, expr, repl_dict=None, old=False)\n",
      " |      Helper method for match() that looks for a match between Wild symbols\n",
      " |      in self and expressions in expr.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import symbols, Wild, Basic\n",
      " |      >>> a, b, c = symbols('a b c')\n",
      " |      >>> x = Wild('x')\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b, c)) is None\n",
      " |      True\n",
      " |      >>> Basic(a + x, x).matches(Basic(a + b + c, b + c))\n",
      " |      {x_: b + c}\n",
      " |\n",
      " |  rcall(self, *args)\n",
      " |      Apply on the argument recursively through the expression tree.\n",
      " |\n",
      " |      This method is used to simulate a common abuse of notation for\n",
      " |      operators. For instance, in SymPy the following will not work:\n",
      " |\n",
      " |      ``(x+Lambda(y, 2*y))(z) == x+2*z``,\n",
      " |\n",
      " |      however, you can use:\n",
      " |\n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> (x + Lambda(y, 2*y)).rcall(z)\n",
      " |      x + 2*z\n",
      " |\n",
      " |  refine(self, assumption=True)\n",
      " |      See the refine function in sympy.assumptions\n",
      " |\n",
      " |  replace(self, query, value, map=False, simultaneous=True, exact=None)\n",
      " |      Replace matching subexpressions of ``self`` with ``value``.\n",
      " |\n",
      " |      If ``map = True`` then also return the mapping {old: new} where ``old``\n",
      " |      was a sub-expression found with query and ``new`` is the replacement\n",
      " |      value for it. If the expression itself does not match the query, then\n",
      " |      the returned value will be ``self.xreplace(map)`` otherwise it should\n",
      " |      be ``self.subs(ordered(map.items()))``.\n",
      " |\n",
      " |      Traverses an expression tree and performs replacement of matching\n",
      " |      subexpressions from the bottom to the top of the tree. The default\n",
      " |      approach is to do the replacement in a simultaneous fashion so\n",
      " |      changes made are targeted only once. If this is not desired or causes\n",
      " |      problems, ``simultaneous`` can be set to False.\n",
      " |\n",
      " |      In addition, if an expression containing more than one Wild symbol\n",
      " |      is being used to match subexpressions and the ``exact`` flag is None\n",
      " |      it will be set to True so the match will only succeed if all non-zero\n",
      " |      values are received for each Wild that appears in the match pattern.\n",
      " |      Setting this to False accepts a match of 0; while setting it True\n",
      " |      accepts all matches that have a 0 in them. See example below for\n",
      " |      cautions.\n",
      " |\n",
      " |      The list of possible combinations of queries and replacement values\n",
      " |      is listed below:\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      Initial setup\n",
      " |\n",
      " |      >>> from sympy import log, sin, cos, tan, Wild, Mul, Add\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> f = log(sin(x)) + tan(sin(x**2))\n",
      " |\n",
      " |      1.1. type -> type\n",
      " |          obj.replace(type, newtype)\n",
      " |\n",
      " |          When object of type ``type`` is found, replace it with the\n",
      " |          result of passing its argument(s) to ``newtype``.\n",
      " |\n",
      " |          >>> f.replace(sin, cos)\n",
      " |          log(cos(x)) + tan(cos(x**2))\n",
      " |          >>> sin(x).replace(sin, cos, map=True)\n",
      " |          (cos(x), {sin(x): cos(x)})\n",
      " |          >>> (x*y).replace(Mul, Add)\n",
      " |          x + y\n",
      " |\n",
      " |      1.2. type -> func\n",
      " |          obj.replace(type, func)\n",
      " |\n",
      " |          When object of type ``type`` is found, apply ``func`` to its\n",
      " |          argument(s). ``func`` must be written to handle the number\n",
      " |          of arguments of ``type``.\n",
      " |\n",
      " |          >>> f.replace(sin, lambda arg: sin(2*arg))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |          >>> (x*y).replace(Mul, lambda *args: sin(2*Mul(*args)))\n",
      " |          sin(2*x*y)\n",
      " |\n",
      " |      2.1. pattern -> expr\n",
      " |          obj.replace(pattern(wild), expr(wild))\n",
      " |\n",
      " |          Replace subexpressions matching ``pattern`` with the expression\n",
      " |          written in terms of the Wild symbols in ``pattern``.\n",
      " |\n",
      " |          >>> a, b = map(Wild, 'ab')\n",
      " |          >>> f.replace(sin(a), tan(a))\n",
      " |          log(tan(x)) + tan(tan(x**2))\n",
      " |          >>> f.replace(sin(a), tan(a/2))\n",
      " |          log(tan(x/2)) + tan(tan(x**2/2))\n",
      " |          >>> f.replace(sin(a), a)\n",
      " |          log(x) + tan(x**2)\n",
      " |          >>> (x*y).replace(a*x, a)\n",
      " |          y\n",
      " |\n",
      " |          Matching is exact by default when more than one Wild symbol\n",
      " |          is used: matching fails unless the match gives non-zero\n",
      " |          values for all Wild symbols:\n",
      " |\n",
      " |          >>> (2*x + y).replace(a*x + b, b - a)\n",
      " |          y - 2\n",
      " |          >>> (2*x).replace(a*x + b, b - a)\n",
      " |          2*x\n",
      " |\n",
      " |          When set to False, the results may be non-intuitive:\n",
      " |\n",
      " |          >>> (2*x).replace(a*x + b, b - a, exact=False)\n",
      " |          2/x\n",
      " |\n",
      " |      2.2. pattern -> func\n",
      " |          obj.replace(pattern(wild), lambda wild: expr(wild))\n",
      " |\n",
      " |          All behavior is the same as in 2.1 but now a function in terms of\n",
      " |          pattern variables is used rather than an expression:\n",
      " |\n",
      " |          >>> f.replace(sin(a), lambda a: sin(2*a))\n",
      " |          log(sin(2*x)) + tan(sin(2*x**2))\n",
      " |\n",
      " |      3.1. func -> func\n",
      " |          obj.replace(filter, func)\n",
      " |\n",
      " |          Replace subexpression ``e`` with ``func(e)`` if ``filter(e)``\n",
      " |          is True.\n",
      " |\n",
      " |          >>> g = 2*sin(x**3)\n",
      " |          >>> g.replace(lambda expr: expr.is_Number, lambda expr: expr**2)\n",
      " |          4*sin(x**9)\n",
      " |\n",
      " |      The expression itself is also targeted by the query but is done in\n",
      " |      such a fashion that changes are not made twice.\n",
      " |\n",
      " |          >>> e = x*(x*y + 1)\n",
      " |          >>> e.replace(lambda x: x.is_Mul, lambda x: 2*x)\n",
      " |          2*x*(2*x*y + 1)\n",
      " |\n",
      " |      When matching a single symbol, `exact` will default to True, but\n",
      " |      this may or may not be the behavior that is desired:\n",
      " |\n",
      " |      Here, we want `exact=False`:\n",
      " |\n",
      " |      >>> from sympy import Function\n",
      " |      >>> f = Function('f')\n",
      " |      >>> e = f(1) + f(0)\n",
      " |      >>> q = f(a), lambda a: f(a + 1)\n",
      " |      >>> e.replace(*q, exact=False)\n",
      " |      f(1) + f(2)\n",
      " |      >>> e.replace(*q, exact=True)\n",
      " |      f(0) + f(2)\n",
      " |\n",
      " |      But here, the nature of matching makes selecting\n",
      " |      the right setting tricky:\n",
      " |\n",
      " |      >>> e = x**(1 + y)\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**(1 + y)).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(-x - y + 1)\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=False)\n",
      " |      x\n",
      " |      >>> (x**y).replace(x**(1 + a), lambda a: x**-a, exact=True)\n",
      " |      x**(1 - y)\n",
      " |\n",
      " |      It is probably better to use a different form of the query\n",
      " |      that describes the target expression more precisely:\n",
      " |\n",
      " |      >>> (1 + x**(1 + y)).replace(\n",
      " |      ... lambda x: x.is_Pow and x.exp.is_Add and x.exp.args[0] == 1,\n",
      " |      ... lambda x: x.base**(1 - (x.exp - 1)))\n",
      " |      ...\n",
      " |      x**(1 - y) + 1\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |\n",
      " |      subs: substitution of subexpressions as defined by the objects\n",
      " |            themselves.\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |\n",
      " |  rewrite(self, *args, deep=True, **hints)\n",
      " |      Rewrite *self* using a defined rule.\n",
      " |\n",
      " |      Rewriting transforms an expression to another, which is mathematically\n",
      " |      equivalent but structurally different. For example you can rewrite\n",
      " |      trigonometric functions as complex exponentials or combinatorial\n",
      " |      functions as gamma function.\n",
      " |\n",
      " |      This method takes a *pattern* and a *rule* as positional arguments.\n",
      " |      *pattern* is optional parameter which defines the types of expressions\n",
      " |      that will be transformed. If it is not passed, all possible expressions\n",
      " |      will be rewritten. *rule* defines how the expression will be rewritten.\n",
      " |\n",
      " |      Parameters\n",
      " |      ==========\n",
      " |\n",
      " |      args : Expr\n",
      " |          A *rule*, or *pattern* and *rule*.\n",
      " |          - *pattern* is a type or an iterable of types.\n",
      " |          - *rule* can be any object.\n",
      " |\n",
      " |      deep : bool, optional\n",
      " |          If ``True``, subexpressions are recursively transformed. Default is\n",
      " |          ``True``.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      If *pattern* is unspecified, all possible expressions are transformed.\n",
      " |\n",
      " |      >>> from sympy import cos, sin, exp, I\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> expr = cos(x) + I*sin(x)\n",
      " |      >>> expr.rewrite(exp)\n",
      " |      exp(I*x)\n",
      " |\n",
      " |      Pattern can be a type or an iterable of types.\n",
      " |\n",
      " |      >>> expr.rewrite(sin, exp)\n",
      " |      exp(I*x)/2 + cos(x) - exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos,], exp)\n",
      " |      exp(I*x)/2 + I*sin(x) + exp(-I*x)/2\n",
      " |      >>> expr.rewrite([cos, sin], exp)\n",
      " |      exp(I*x)\n",
      " |\n",
      " |      Rewriting behavior can be implemented by defining ``_eval_rewrite()``\n",
      " |      method.\n",
      " |\n",
      " |      >>> from sympy import Expr, sqrt, pi\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite(self, rule, args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         if rule == cos:\n",
      " |      ...             return cos(pi/2 - x, evaluate=False)\n",
      " |      ...         if rule == sqrt:\n",
      " |      ...             return sqrt(1 - cos(x)**2)\n",
      " |      >>> MySin(MySin(x)).rewrite(cos)\n",
      " |      cos(-cos(-x + pi/2) + pi/2)\n",
      " |      >>> MySin(x).rewrite(sqrt)\n",
      " |      sqrt(1 - cos(x)**2)\n",
      " |\n",
      " |      Defining ``_eval_rewrite_as_[...]()`` method is supported for backwards\n",
      " |      compatibility reason. This may be removed in the future and using it is\n",
      " |      discouraged.\n",
      " |\n",
      " |      >>> class MySin(Expr):\n",
      " |      ...     def _eval_rewrite_as_cos(self, *args, **hints):\n",
      " |      ...         x, = args\n",
      " |      ...         return cos(pi/2 - x, evaluate=False)\n",
      " |      >>> MySin(x).rewrite(cos)\n",
      " |      cos(-x + pi/2)\n",
      " |\n",
      " |  simplify(self, **kwargs)\n",
      " |      See the simplify function in sympy.simplify\n",
      " |\n",
      " |  subs(self, *args, **kwargs)\n",
      " |      Substitutes old for new in an expression after sympifying args.\n",
      " |\n",
      " |      `args` is either:\n",
      " |        - two arguments, e.g. foo.subs(old, new)\n",
      " |        - one iterable argument, e.g. foo.subs(iterable). The iterable may be\n",
      " |           o an iterable container with (old, new) pairs. In this case the\n",
      " |             replacements are processed in the order given with successive\n",
      " |             patterns possibly affecting replacements already made.\n",
      " |           o a dict or set whose key/value items correspond to old/new pairs.\n",
      " |             In this case the old/new pairs will be sorted by op count and in\n",
      " |             case of a tie, by number of args and the default_sort_key. The\n",
      " |             resulting sorted list is then processed as an iterable container\n",
      " |             (see previous).\n",
      " |\n",
      " |      If the keyword ``simultaneous`` is True, the subexpressions will not be\n",
      " |      evaluated until all the substitutions have been made.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import pi, exp, limit, oo\n",
      " |      >>> from sympy.abc import x, y\n",
      " |      >>> (1 + x*y).subs(x, pi)\n",
      " |      pi*y + 1\n",
      " |      >>> (1 + x*y).subs({x:pi, y:2})\n",
      " |      1 + 2*pi\n",
      " |      >>> (1 + x*y).subs([(x, pi), (y, 2)])\n",
      " |      1 + 2*pi\n",
      " |      >>> reps = [(y, x**2), (x, 2)]\n",
      " |      >>> (x + y).subs(reps)\n",
      " |      6\n",
      " |      >>> (x + y).subs(reversed(reps))\n",
      " |      x**2 + 2\n",
      " |\n",
      " |      >>> (x**2 + x**4).subs(x**2, y)\n",
      " |      y**2 + y\n",
      " |\n",
      " |      To replace only the x**2 but not the x**4, use xreplace:\n",
      " |\n",
      " |      >>> (x**2 + x**4).xreplace({x**2: y})\n",
      " |      x**4 + y\n",
      " |\n",
      " |      To delay evaluation until all substitutions have been made,\n",
      " |      set the keyword ``simultaneous`` to True:\n",
      " |\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)])\n",
      " |      0\n",
      " |      >>> (x/y).subs([(x, 0), (y, 0)], simultaneous=True)\n",
      " |      nan\n",
      " |\n",
      " |      This has the added feature of not allowing subsequent substitutions\n",
      " |      to affect those already made:\n",
      " |\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y})\n",
      " |      1\n",
      " |      >>> ((x + y)/y).subs({x + y: y, y: x + y}, simultaneous=True)\n",
      " |      y/(x + y)\n",
      " |\n",
      " |      In order to obtain a canonical result, unordered iterables are\n",
      " |      sorted by count_op length, number of arguments and by the\n",
      " |      default_sort_key to break any ties. All other iterables are left\n",
      " |      unsorted.\n",
      " |\n",
      " |      >>> from sympy import sqrt, sin, cos\n",
      " |      >>> from sympy.abc import a, b, c, d, e\n",
      " |\n",
      " |      >>> A = (sqrt(sin(2*x)), a)\n",
      " |      >>> B = (sin(2*x), b)\n",
      " |      >>> C = (cos(2*x), c)\n",
      " |      >>> D = (x, d)\n",
      " |      >>> E = (exp(x), e)\n",
      " |\n",
      " |      >>> expr = sqrt(sin(2*x))*sin(exp(x)*x)*cos(2*x) + sin(2*x)\n",
      " |\n",
      " |      >>> expr.subs(dict([A, B, C, D, E]))\n",
      " |      a*c*sin(d*e) + b\n",
      " |\n",
      " |      The resulting expression represents a literal replacement of the\n",
      " |      old arguments with the new arguments. This may not reflect the\n",
      " |      limiting behavior of the expression:\n",
      " |\n",
      " |      >>> (x**3 - 3*x).subs({x: oo})\n",
      " |      nan\n",
      " |\n",
      " |      >>> limit(x**3 - 3*x, x, oo)\n",
      " |      oo\n",
      " |\n",
      " |      If the substitution will be followed by numerical\n",
      " |      evaluation, it is better to pass the substitution to\n",
      " |      evalf as\n",
      " |\n",
      " |      >>> (1/x).evalf(subs={x: 3.0}, n=21)\n",
      " |      0.333333333333333333333\n",
      " |\n",
      " |      rather than\n",
      " |\n",
      " |      >>> (1/x).subs({x: 3.0}).evalf(21)\n",
      " |      0.333333333333333314830\n",
      " |\n",
      " |      as the former will ensure that the desired level of precision is\n",
      " |      obtained.\n",
      " |\n",
      " |      See Also\n",
      " |      ========\n",
      " |      replace: replacement capable of doing wildcard-like matching,\n",
      " |               parsing of match, and conditional replacements\n",
      " |      xreplace: exact node replacement in expr tree; also capable of\n",
      " |                using matching rules\n",
      " |      sympy.core.evalf.EvalfMixin.evalf: calculates the given formula to a desired level of precision\n",
      " |\n",
      " |  xreplace lambda rule, **_ from sympy.core.function.FunctionClass.xreplace.<locals>\n",
      " |      # Function needs args so we define a property that returns\n",
      " |      # a function that takes args...and then use that function\n",
      " |      # to return the right value\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Class methods inherited from sympy.core.basic.Basic:\n",
      " |\n",
      " |  __init_subclass__()\n",
      " |      This method is called when a class is subclassed.\n",
      " |\n",
      " |      The default implementation does nothing. It may be\n",
      " |      overridden to extend subclasses.\n",
      " |\n",
      " |  fromiter(args, **assumptions)\n",
      " |      Create a new object from an iterable.\n",
      " |\n",
      " |      This is a convenience function that allows one to create objects from\n",
      " |      any iterable, without having to convert to a list or tuple first.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Tuple\n",
      " |      >>> Tuple.fromiter(i for i in range(5))\n",
      " |      (0, 1, 2, 3, 4)\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Readonly properties inherited from sympy.core.basic.Basic:\n",
      " |\n",
      " |  __sympy__\n",
      " |\n",
      " |  args\n",
      " |      Returns a tuple of arguments of 'self'.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import cot\n",
      " |      >>> from sympy.abc import x, y\n",
      " |\n",
      " |      >>> cot(x).args\n",
      " |      (x,)\n",
      " |\n",
      " |      >>> cot(x).args[0]\n",
      " |      x\n",
      " |\n",
      " |      >>> (x*y).args\n",
      " |      (x, y)\n",
      " |\n",
      " |      >>> (x*y).args[1]\n",
      " |      y\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      Never use self._args, always use self.args.\n",
      " |      Only use _args in __new__ when creating a new function.\n",
      " |      Do not override .args() from Basic (so that it is easy to\n",
      " |      change the interface in the future if needed).\n",
      " |\n",
      " |  assumptions0\n",
      " |      Return object `type` assumptions.\n",
      " |\n",
      " |      For example:\n",
      " |\n",
      " |        Symbol('x', real=True)\n",
      " |        Symbol('x', integer=True)\n",
      " |\n",
      " |      are different objects. In other words, besides Python type (Symbol in\n",
      " |      this case), the initial assumptions are also forming their typeinfo.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Symbol\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True}\n",
      " |      >>> x = Symbol(\"x\", positive=True)\n",
      " |      >>> x.assumptions0\n",
      " |      {'commutative': True, 'complex': True, 'extended_negative': False,\n",
      " |       'extended_nonnegative': True, 'extended_nonpositive': False,\n",
      " |       'extended_nonzero': True, 'extended_positive': True, 'extended_real':\n",
      " |       True, 'finite': True, 'hermitian': True, 'imaginary': False,\n",
      " |       'infinite': False, 'negative': False, 'nonnegative': True,\n",
      " |       'nonpositive': False, 'nonzero': True, 'positive': True, 'real':\n",
      " |       True, 'zero': False}\n",
      " |\n",
      " |  canonical_variables\n",
      " |      Return a dictionary mapping any variable defined in\n",
      " |      ``self.bound_symbols`` to Symbols that do not clash\n",
      " |      with any free symbols in the expression.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import Lambda\n",
      " |      >>> from sympy.abc import x\n",
      " |      >>> Lambda(x, 2*x).canonical_variables\n",
      " |      {x: _0}\n",
      " |\n",
      " |  free_symbols\n",
      " |      Return from the atoms of self those which are free symbols.\n",
      " |\n",
      " |      Not all free symbols are ``Symbol``. Eg: IndexedBase('I')[0].free_symbols\n",
      " |\n",
      " |      For most expressions, all symbols are free symbols. For some classes\n",
      " |      this is not true. e.g. Integrals use Symbols for the dummy variables\n",
      " |      which are bound variables, so Integral has a method to return all\n",
      " |      symbols except those. Derivative keeps track of symbols with respect\n",
      " |      to which it will perform a derivative; those are\n",
      " |      bound variables, too, so it has its own free_symbols method.\n",
      " |\n",
      " |      Any other method that uses bound variables should implement a\n",
      " |      free_symbols method.\n",
      " |\n",
      " |  is_algebraic\n",
      " |\n",
      " |  is_antihermitian\n",
      " |\n",
      " |  is_commutative\n",
      " |\n",
      " |  is_comparable\n",
      " |      Return True if self can be computed to a real number\n",
      " |      (or already is a real number) with precision, else False.\n",
      " |\n",
      " |      Examples\n",
      " |      ========\n",
      " |\n",
      " |      >>> from sympy import exp_polar, pi, I\n",
      " |      >>> (I*exp_polar(I*pi/2)).is_comparable\n",
      " |      True\n",
      " |      >>> (I*exp_polar(I*pi*2)).is_comparable\n",
      " |      False\n",
      " |\n",
      " |      A False result does not mean that `self` cannot be rewritten\n",
      " |      into a form that would be comparable. For example, the\n",
      " |      difference computed below is zero but without simplification\n",
      " |      it does not evaluate to a zero with precision:\n",
      " |\n",
      " |      >>> e = 2**pi*(1 + 2**pi)\n",
      " |      >>> dif = e - e.expand()\n",
      " |      >>> dif.is_comparable\n",
      " |      False\n",
      " |      >>> dif.n(2)._prec\n",
      " |      1\n",
      " |\n",
      " |  is_complex\n",
      " |\n",
      " |  is_composite\n",
      " |\n",
      " |  is_even\n",
      " |\n",
      " |  is_extended_negative\n",
      " |\n",
      " |  is_extended_nonnegative\n",
      " |\n",
      " |  is_extended_nonpositive\n",
      " |\n",
      " |  is_extended_nonzero\n",
      " |\n",
      " |  is_extended_positive\n",
      " |\n",
      " |  is_extended_real\n",
      " |\n",
      " |  is_finite\n",
      " |\n",
      " |  is_hermitian\n",
      " |\n",
      " |  is_imaginary\n",
      " |\n",
      " |  is_infinite\n",
      " |\n",
      " |  is_integer\n",
      " |\n",
      " |  is_irrational\n",
      " |\n",
      " |  is_negative\n",
      " |\n",
      " |  is_noninteger\n",
      " |\n",
      " |  is_nonnegative\n",
      " |\n",
      " |  is_nonpositive\n",
      " |\n",
      " |  is_nonzero\n",
      " |\n",
      " |  is_odd\n",
      " |\n",
      " |  is_polar\n",
      " |\n",
      " |  is_positive\n",
      " |\n",
      " |  is_prime\n",
      " |\n",
      " |  is_rational\n",
      " |\n",
      " |  is_real\n",
      " |\n",
      " |  is_transcendental\n",
      " |\n",
      " |  is_zero\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Data and other attributes inherited from sympy.core.basic.Basic:\n",
      " |\n",
      " |  is_Add = False\n",
      " |\n",
      " |  is_AlgebraicNumber = False\n",
      " |\n",
      " |  is_Atom = False\n",
      " |\n",
      " |  is_Boolean = False\n",
      " |\n",
      " |  is_Derivative = False\n",
      " |\n",
      " |  is_Dummy = False\n",
      " |\n",
      " |  is_Equality = False\n",
      " |\n",
      " |  is_Float = False\n",
      " |\n",
      " |  is_Indexed = False\n",
      " |\n",
      " |  is_Integer = False\n",
      " |\n",
      " |  is_MatAdd = False\n",
      " |\n",
      " |  is_MatMul = False\n",
      " |\n",
      " |  is_Matrix = False\n",
      " |\n",
      " |  is_Mul = False\n",
      " |\n",
      " |  is_Not = False\n",
      " |\n",
      " |  is_Number = False\n",
      " |\n",
      " |  is_NumberSymbol = False\n",
      " |\n",
      " |  is_Order = False\n",
      " |\n",
      " |  is_Piecewise = False\n",
      " |\n",
      " |  is_Point = False\n",
      " |\n",
      " |  is_Poly = False\n",
      " |\n",
      " |  is_Pow = False\n",
      " |\n",
      " |  is_Rational = False\n",
      " |\n",
      " |  is_Relational = False\n",
      " |\n",
      " |  is_Symbol = False\n",
      " |\n",
      " |  is_Vector = False\n",
      " |\n",
      " |  is_Wild = False\n",
      " |\n",
      " |  is_symbol = False\n",
      " |\n",
      " |  kind = UndefinedKind\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.printing.defaults.Printable:\n",
      " |\n",
      " |  __repr__ = __str__(self)\n",
      " |\n",
      " |  __str__(self) from sympy.core._print_helpers.Printable\n",
      " |      Return str(self).\n",
      " |\n",
      " |  ----------------------------------------------------------------------\n",
      " |  Methods inherited from sympy.core.evalf.EvalfMixin:\n",
      " |\n",
      " |  evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      " |      Evaluate the given formula to an accuracy of *n* digits.\n",
      " |\n",
      " |      Parameters\n",
      " |      ==========\n",
      " |\n",
      " |      subs : dict, optional\n",
      " |          Substitute numerical values for symbols, e.g.\n",
      " |          ``subs={x:3, y:1+pi}``. The substitutions must be given as a\n",
      " |          dictionary.\n",
      " |\n",
      " |      maxn : int, optional\n",
      " |          Allow a maximum temporary working precision of maxn digits.\n",
      " |\n",
      " |      chop : bool or number, optional\n",
      " |          Specifies how to replace tiny real or imaginary parts in\n",
      " |          subresults by exact zeros.\n",
      " |\n",
      " |          When ``True`` the chop value defaults to standard precision.\n",
      " |\n",
      " |          Otherwise the chop value is used to determine the\n",
      " |          magnitude of \"small\" for purposes of chopping.\n",
      " |\n",
      " |          >>> from sympy import N\n",
      " |          >>> x = 1e-4\n",
      " |          >>> N(x, chop=True)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-5)\n",
      " |          0.000100000000000000\n",
      " |          >>> N(x, chop=1e-4)\n",
      " |          0\n",
      " |\n",
      " |      strict : bool, optional\n",
      " |          Raise ``PrecisionExhausted`` if any subresult fails to\n",
      " |          evaluate to full accuracy, given the available maxprec.\n",
      " |\n",
      " |      quad : str, optional\n",
      " |          Choose algorithm for numerical quadrature. By default,\n",
      " |          tanh-sinh quadrature is used. For oscillatory\n",
      " |          integrals on an infinite interval, try ``quad='osc'``.\n",
      " |\n",
      " |      verbose : bool, optional\n",
      " |          Print debug information.\n",
      " |\n",
      " |      Notes\n",
      " |      =====\n",
      " |\n",
      " |      When Floats are naively substituted into an expression,\n",
      " |      precision errors may adversely affect the result. For example,\n",
      " |      adding 1e16 (a Float) to 1 will truncate to 1e16; if 1e16 is\n",
      " |      then subtracted, the result will be 0.\n",
      " |      That is exactly what happens in the following:\n",
      " |\n",
      " |      >>> from sympy.abc import x, y, z\n",
      " |      >>> values = {x: 1e16, y: 1, z: 1e16}\n",
      " |      >>> (x + y - z).subs(values)\n",
      " |      0\n",
      " |\n",
      " |      Using the subs argument for evalf is the accurate way to\n",
      " |      evaluate such an expression:\n",
      " |\n",
      " |      >>> (x + y - z).evalf(subs=values)\n",
      " |      1.00000000000000\n",
      " |\n",
      " |  n = evalf(self, n=15, subs=None, maxn=100, chop=False, strict=False, quad=None, verbose=False)\n",
      "\n"
     ]
    }
   ],
   "source": [
    "help(sin)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "f8ebcc6a",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.functions.elementary.trigonometric import sin"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "9a85af77",
   "metadata": {},
   "outputs": [],
   "source": [
    "x=symbols(\"x\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "225fa718",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle x$"
      ],
      "text/plain": [
       "x"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "44b5a2c4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "$\\displaystyle \\sin{\\left(x \\right)}$"
      ],
      "text/plain": [
       "sin(x)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sin(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b6d44e70",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "29c2d991",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.12'"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "__version__\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "6859732f",
   "metadata": {},
   "outputs": [],
   "source": [
    "from sympy.utilities.iterables import permutations"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.7"
  },
  "vscode": {
   "interpreter": {
    "hash": "31f2aee4e71d21fbe5cf8b01ff0e069b9275f58929596ceb00d14d90e3e16cd6"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
